TIF/PSD to JPEG conversion makes image white

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
Malmodir
Posts: 4
Joined: 2014-01-16T02:05:34-07:00
Authentication code: 6789

TIF/PSD to JPEG conversion makes image white

Post by Malmodir »

Hi there,

I recently encountered a problem converting certain TIF and PSD files to JPEG. I could get single images right by manually adjusting the arguments, but I have to find a generic, software driven solution. I have no idea what is causing the issue, whether it's the parameters or the file, if it's the alpha channel or the compression and so on...

The input file:
https://www.dropbox.com/s/nzse4u7ttbarsmb/83_55991.tif (on my machine does only view in GIMP and IrfanView)

The result:
https://www.dropbox.com/s/gdgfr0owovu8w ... 5991_1.jpg

These are the commandline arguments:

Code: Select all

convert "D:\TFS6118\83_55991.tif" -limit thread 1 -strip -profile "USWebCoatedSWOP.icc" -scale 777x777! -density 300 -units pixelsperinch -profile "sRGB Color Space Profile.ICM" -strip "D:\TFS6118\83_55991_1.jpg
Trying different parameter variations, I recognized the problem seems to only appear when the "-scale ..." parameter is being supplied. The IM versions I tried are 6.8.3 and 6.8.9.

If I span the command over two pass-throughs (one for conversion, one for resize) it almost works, seems a little dark though:
https://www.dropbox.com/s/5mhu1b7trt84s ... 5991_2.jpg


Your help is appreciated, thank you :)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIF/PSD to JPEG conversion makes image white

Post by snibgo »

-strip -profile "USWebCoatedSWOP.icc"
Your file has an embedded profile. Your command says, "Ignore the embedded profile, and assume this one instead." Any particular reason for doing this?

This works fine for me (IM v6.8.9-0 on Windows 8.1):

Code: Select all

convert 83_55991.tif -alpha off -profile sRGB.icc out.png
... with or without "-scale". I don't know what you intend, but "-resize" might suit you better.
snibgo's IM pages: im.snibgo.com
Malmodir
Posts: 4
Joined: 2014-01-16T02:05:34-07:00
Authentication code: 6789

Re: TIF/PSD to JPEG conversion makes image white

Post by Malmodir »

It depends on what the user configures. He has the options to maintain the profile or swap it from sRGB to CMYK and vice-versa, if the input file already is on CMYK we leave it. I had a few problems with files not having a profile embedded.

Yes, this also works with me, also targetting JPEG! Thank you!

But... How can I know when to use it?
Currently folks are converting PNGs or EPS for web exports, I can't just generally turn off alpha channels. What I need is a way to determine the necessity of this switch and apply it transparently.

Or if I relay the decision to the user as an additional option: How would I communicate this regarding effect, reasons...?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIF/PSD to JPEG conversion makes image white

Post by snibgo »

I suspect you have no good reason for stripping any existing profile. If you simply remove that first "-strip" then IM would convert the image from the embedded profile to USWebCoatedSWOP. If it didn't have an embedded profile, it would assign USWebCoatedSWOP. I suspect this would be better behaviour.

Your alpha is unassociated. This seems to be case when PS uses alpha as a mask. See viewtopic.php?f=3&t=25684&p=111939#p111886
snibgo's IM pages: im.snibgo.com
Post Reply