Converting BMP to fixed 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
Thamior

Converting BMP to fixed size JPEG

Post by Thamior »

Hello. I need to convert BMP files to JPEG which are less or equal 64 Kbyte in size. It could be achieved using different methods, such as turning image to grayscale, setting lower resolution and setting lower quality when convert the image. I haven't found how to lower quality of JPEG. Also what would you suggest in this situation?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting BMP to fixed size JPEG

Post by snibgo »

Code: Select all

convert in.bmp -quality 50 out.jpg
I don't think IM has an automated facility to choose the highest quality with a cap on the resulting filesize. You would have to do that in a script.

Personally, I would reduce the "quality" number until either I reached the 64KB limit or quality became unacceptable. Only then, if necessary, would I reduce resolution. You might prefer the opposite.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting BMP to fixed size JPEG

Post by fmw42 »

I have a unix bash script, downsize, that changes the image dimensions to get to a desired filesize. It does not adjust quality/compression. see link below
Post Reply