JPG compression for High Altitude Balloon

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
dronshaw
Posts: 1
Joined: 2013-03-19T17:18:07-07:00
Authentication code: 6789

JPG compression for High Altitude Balloon

Post by dronshaw »

Working on a high altitude balloon project and needing to compress the JPG located on a Raspberry Pi. Cannot locate the best way to compress a ~50 - 75 kB JPG to around 7 kB. Hoping someone can point me in the right direction or give me advice.

Thanks for reading.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG compression for High Altitude Balloon

Post by fmw42 »

I do not believe that Imagemagick has unique controls to set an image filesize. You need to adjust the -quality, -compression, etc to get what you want. See http://www.imagemagick.org/Usage/formats/#jpg_write

One could write a script to loop and try various quality settings until one reaches the desired filesize.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: JPG compression for High Altitude Balloon

Post by anthony »

-define jpeg:extent={size}
As of IM v6.5.8-2 you can specify a maximum output filesize for the JPEG image. The size is specified with a suffix. For example "400kb".


However as fred pointed out this essentually just binary search on the 'quality' setting to find one that produces a file that is smaller than the given amount.

It is thus many times slower.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG compression for High Altitude Balloon

Post by fmw42 »

anthony wrote:-define jpeg:extent={size}
As of IM v6.5.8-2 you can specify a maximum output filesize for the JPEG image. The size is specified with a suffix. For example "400kb".
OOPS! Thanks Anthony. I mistook that for the read size. So there is a way to specify the output file size. My mistake.
Post Reply