Maximum size jpeg

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
karlmistelberger
Posts: 2
Joined: 2014-11-03T05:35:11-07:00
Authentication code: 6789

Maximum size jpeg

Post by karlmistelberger »

When resizing I use the following command:

Code: Select all

convert -distort resize 800x -strip -quality 70
Applying this command results in output files with wildly varying sizes, e.g. 30-250 KB. I want to have output files with a maximum size adjusted to the web server's rigid limit (150KB) by adapting quality values. Doing this by hand is tedious. Can I do this automatically?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Maximum size jpeg

Post by snibgo »

I suppose the output format is jpeg.

Code: Select all

convert -distort resize 800x -strip -define jpeg:extent=150KB out.jpg
[Mod note: split from irrelevant thread.]
snibgo's IM pages: im.snibgo.com
karlmistelberger
Posts: 2
Joined: 2014-11-03T05:35:11-07:00
Authentication code: 6789

Re: Maximum size jpeg

Post by karlmistelberger »

Applied the command to 85 images in folder. There was some wait, but the result is exactly what I hoped for. Sizes are now 100-149 KB and all pictures look fine. Thanks for relocating the post. :D
Post Reply