简体   繁体   English

更改图像质量(不更改分辨率)

[英]Change the quality of the image (without changing the resolution)

I found this command 我找到了这个命令

Resize an image with improved quality: 调整图像尺寸以提高质量:

$ convert input.png -colorspace RGB +sigmoidal-contrast 11.6933 \ 
-define filter:filter=Sinc -define filter:window=Jinc -define filter:lobes=3 \ 
-resize 400% -sigmoidal-contrast 11.6933 -colorspace sRGB output.png

But I need something else, I need a command to decrease the image quality. 但是我还需要其他东西,我需要一个命令来降低图像质量。 For example if the input.png is 100pix x 100pix resolution and 100KB size I want to make an output.png image with the same resolution but lower quality, let say 50KB 例如,如果input.png为100pix x 100pix分辨率且大小为100KB,我想制作具有相同分辨率但质量较低的output.png图像,例如50KB

how can I do this ? 我怎样才能做到这一点 ?

(My original problem is the limitation to 50KB images, and all I want to do is convert all my images below 50KB size). (我最初的问题是限制为50KB图像,我要做的就是将所有小于50KB的图像转换为50KB)。

I hope this is easy to solve but could not figured out on my own. 我希望这很容易解决,但我自己无法解决。

Thanks 谢谢

Simply convert the image to a lower sampling rate. 只需将图像转换为较低的采样率即可。 ImageMagick has an article on Transformations that cover a few options. ImageMagick关于转换的文章涵盖了一些选项。

convert input.png -sample 25% -scale 400% output.png

Results: 结果:

input.png  PNG 640x480 640x480+0+0 8-bit sRGB 256c 27.4KB 0.000u 0:00.000
output.png PNG 640x480 640x480+0+0 8-bit sRGB 225c 6.58KB 0.000u 0:00.000

input.png input.png input.png

output.png output.png output.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM