Yet another tif to jpg conversion with wrong colors..

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
mmx
Posts: 5
Joined: 2013-11-06T10:39:53-07:00
Authentication code: 6789

Yet another tif to jpg conversion with wrong colors..

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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?
mmx
Posts: 5
Joined: 2013-11-06T10:39:53-07:00
Authentication code: 6789

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

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
mmx
Posts: 5
Joined: 2013-11-06T10:39:53-07:00
Authentication code: 6789

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

Post 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!
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

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

Post by holden »

You can report it as a bug here viewforum.php?f=3

link to this thread
mmx
Posts: 5
Joined: 2013-11-06T10:39:53-07:00
Authentication code: 6789

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

Post 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!
Post Reply