Degrade image quality until a certain size(KB) is reached

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
6martina6

Degrade image quality until a certain size(KB) is reached

Post by 6martina6 »

Hi all,

I need a script to degrade the quality of an image until 50kB of size is reached.
Do you know if it's possible to achieve this using IM?

Thank you very much ;)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Degrade image quality until a certain size(KB) is reached

Post by magick »

If the image is JPEG, to restrict the maximum file size, use jpeg:extent, for example -define jpeg:extent=400kb. See http://www.imagemagick.org/script/formats.php and look for the JPEG format. This option is only available in ImageMagick 6.5.8-10 and above.
6martina6

Re: Degrade image quality until a certain size(KB) is reached

Post by 6martina6 »

This is really usefull!
Thank you very much
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Degrade image quality until a certain size(KB) is reached

Post by fmw42 »

see my unix bash script, downsize at link below
6martina6

Re: Degrade image quality until a certain size(KB) is reached

Post by 6martina6 »

Hi Fred, I know about your downsize script!
It looks great but actually I've to keep the width/height of my jpeg and degrade the quality. -define jpeg:extent is fine for my intent.
Thanks
Post Reply