Tuesday, May 17, 2011

How to fix image color dept problem or why does this picture do not work in IE

We have all stumbled upon a problem when certain pictures (jpegs) work perfectly in firefox, chrome ... but not in IE (any version). The problem is that color depth in image header is different than the actual color depth. So if i.e. actual color depth of a picture is 24bit but header reports that it is 32bit, this picture will not display in IE. If you are using Linux, you are in luck, because that can simply be fixed.

I've found this site with tools needed (there is also an ubuntu package if you are using ubuntu). To detect the problem use:

jpeginfo -c -merronly Downloads/test.jpg

If there is an error, you will get something like:
Downloads/test.jpg  594 x 420  32bit 
Exif  N  174956  Unsupported color conversion request  [ERROR]

To fix the problem simply use imageMagic:

#convert it to png
mogrify -format png Downloads/test.jpg
#and then back to jpg
mogrify -format jpeg Downloads/test.png

1 comment:

it has said...

Great Article
Image Processing Projects

Deep Learning Projects for Final Year

JavaScript Training in Chennai

JavaScript Training in Chennai

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training