[英]How to expand image without losing quality?
I have a png image, or in a blob. 我有一个png图像或斑点。 This image has a particular size, lets say 800px*600px when I resize it using some canvas methods like this one: Resize image, need a good library it losses quality. 该图像具有特定的大小,例如,当我使用像这样的一些画布方法调整其大小时,可以说800px * 600px: 调整图像大小,需要一个好的库,它会降低质量。
I want to resize my image to something like 4000px and not bluring the content. 我想将图像调整为4000像素左右,而不模糊内容。 Is there a way to do it? 有办法吗? Inside my image there is only text. 我的图片中只有文字。
I am using Angular CLI: 1.7.3 Node: 8.9.0 Angular: 4.4.6 Typescript: 2.3.4 我正在使用Angular CLI:1.7.3节点:8.9.0 Angular:4.4.6打字稿:2.3.4
What's probably happening is that there is some automatic aliasing being applied when you resize the canvas. 可能发生的情况是在调整画布大小时会应用一些自动别名。 Using this other question for reference , it seems that you might need to specify the interpolation mode to nearest-neighbor: 使用这个其他问题作为参考 ,似乎您可能需要将插值模式指定为最近邻:
canvas {
image-rendering: optimizeSpeed; // Older versions of FF
image-rendering: -moz-crisp-edges; // FF 6.0+
image-rendering: -webkit-optimize-contrast; // Webkit (non standard naming)
image-rendering: -o-crisp-edges; // OS X & Windows Opera (12.02+)
image-rendering: crisp-edges; // Possible future browsers.
-ms-interpolation-mode: nearest-neighbor; // IE (non standard naming)
}
(code snippet fetched from referenced question) (从引用的问题中提取的代码段)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.