Page 1 of 1

Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-06T10:49:51-07:00
by mmx
Hello,

I searched almost all the web in order to find out why my .tif is converted to .jpg with wrong colors..

I tried many solutions that worked for others but not for me..

One of the latest commands I tried is the following (I 've tried several ones).

convert -profile img_profiles/CMYK/USWebUncoated.icc -profile img_profiles/RGB/sRGB.icc mytif.tif dest.jpg

here is the link for the .tif and .jpg files
http://makis.partyreports.com/mytif.tif
http://makis.partyreports.com/dest.jpg


I spent 2 days trying on finding a way to solve this with no luck..

The system is (Debian 4.4.5-8)
ImageMagick 6.6.0.4


Thank you!

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-06T12:54:11-07:00
by fmw42
I suspect it has something to do the with the jpg compression used. This gets somewhat close but it not close enough. I am not sure why the -negate is needed, but again I think it has to do with the jpg compression.

Code: Select all

convert mytif.tif -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc -negate mytif.jpg

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-06T13:10:53-07:00
by fmw42
If I open the file in PS and change the compression from JPEG to LZW and save as mytif2.tif then the following works perfectly fine.

Code: Select all

convert mytif2.tif -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc mytif2.jpg
So my suspicion is correct. I am not sure why IM has trouble with CMYK TIFF images with JPEG compression. It may be a bug. But the IM developers will need to check this out. Perhaps one needs some special addition to libtiff or libjpeg?

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-06T13:25:08-07:00
by mmx
Thank you very much for your answers!

Is there any way to change the compression in the tif file with image magick before convert it to jpg?

Thanks!

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-06T13:53:40-07:00
by fmw42
mmx wrote:Thank you very much for your answers!

Is there any way to change the compression in the tif file with image magick before convert it to jpg?

Thanks!
I tried, but that did not seem to help. It seems that IM cannot handle properly the jpg compressed cmyk tiff. So when it reads it to change the compression it improperly handles it.

Neither of these work:

Code: Select all

convert mytif.tif -compress LZW -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc mytif1.jpg


convert mytif.tif -compress LZW TIFF:- | convert - -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc mytif1.jpg

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-07T02:14:35-07:00
by mmx
Thanks fmw42!

So in other words you would suggest me to look for another solution and leave imagemagick behind?

Can I ask for any suggestion?

Let me give you some details about what I am trying to do so you can come up with some ideas..

I have several people uploading to a server tif images like this one (I think they extract the images from pdf files by using tifflib).

Then I want to convert all of them in jpg so I can later present them in HTML pages..

I thought it was trying to something fairly simple but it turned out that is not simple at all!

Thanks again!

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-07T06:04:57-07:00
by holden
You can report it as a bug here viewforum.php?f=3

link to this thread

Re: Yet another tif to jpg conversion with wrong colors..

Posted: 2013-11-07T09:22:21-07:00
by mmx
Thanks guys!

I will report it as a "possible" bug..

So far the solution for me is to do it by calling a python script..

Thanks all for your help!