简体   繁体   中英

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

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).

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.

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

output.png output.png

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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