Convert 32-bit Jpegs to 24-bit

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
bjn
Posts: 13
Joined: 2010-09-06T05:46:08-07:00
Authentication code: 8675308

Convert 32-bit Jpegs to 24-bit

Post by bjn »

I have what jpeginfo identifies as 32-bit Jpegs. They're displaying fine in Firefox on my Linux machine but not in IE8 on my Windows VM. They're also much larger in filesize than I would have expected.

How can I convert them down to normal 24-bit Jpegs? I certainly don't need any kind of alpha channel.

I've tried
$ convert file.jpg -flatten +matte file2.jpg
but they still identify as 32-bit and won't display in IE.

Imagemagick's own identify command says this:
cirrusmosaic_thumb.jpg JPEG 302x271 302x271+0+0 8-bit DirectClass 154KiB 0.000u 0:00.000

An example of such an image is up at http://users.ecs.soton.ac.uk/bjn/cirrusmosaic_thumb.jpg

Thanks.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Convert 32-bit Jpegs to 24-bit

Post by el_supremo »

Your image uses the CMYK colourspace which is why it appears to be 32-bit. This will fix it:

Code: Select all

convert cirrusmosaic_thumb.jpg -colorspace rgb cirrusmosaic_rgb.jpg
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
bjn
Posts: 13
Joined: 2010-09-06T05:46:08-07:00
Authentication code: 8675308

Re: Convert 32-bit Jpegs to 24-bit

Post by bjn »

Thanks very much. This was the solution.
Post Reply