Page 1 of 1

PSD transparency issue (ImageMagick adding white to transparent areas)[Resolved]

Posted: 2014-12-17T22:16:10-07:00
by HomerJohnston
Using ImageMagick 6.9.0-0 Q16 x86 (static DLL Windows build)

I'm trying to convert a PSD file to a TIFF. Here is a screenshot of the original PSD:
http://gyazo.com/2471641bd8a0d41d7019de740aade119

Here is a screenshot of the TIFF saved by ImageMagick, using

Code: Select all

convert "test.psd[0]" -compress lzw "test_im.tiff"
http://gyazo.com/282a44a8495d20f7fb714dfc67b008c3

You can just barely see that ImageMagick is adding some white in the semi-transparent areas around the red. I've been searching for a while to try and figure out a solution, but I'm not very good with IM. Can anyone help me solve this? Thanks very much!

Re: PSD transparency issue (ImageMagick adding white to transparent areas)

Posted: 2014-12-17T23:45:27-07:00
by fmw42
Possibly different layers in the PSD than in its flattened layer [0]? It could also be different type of alpha in the tiff than in the psd, so the blending from the alpha may cause differences in appearance? It is also possible that IM conversion is being handled wrong with alpha in the PSD.

I also see that it is different when I do

Code: Select all

convert test.psd[0] -compress lzw test_im.tiff
convert test.psd[0] -compress lzw -define tiff:alpha=associated test_im_assoc.tiff
convert test.psd[0] -compress lzw -define tiff:alpha=unassociated test_im_unassoc.tiff
convert test.psd[0] -compress lzw -define tiff:alpha=unspecified test_im_unspec.tiff
convert test.psd[0] -compress lzw test_im.psd
All four of the tiff results show the whitening effect.

Furthermore, the PSD has two layers. That is odd, but I suspect, that IM always creates a flattened layer 0, which in this case is the same as layer 1.

I was testing with IM 6.9.0.0 Q16 Mac OSX Snow Leopard.

Re: PSD transparency issue (ImageMagick adding white to transparent areas)

Posted: 2014-12-18T08:13:05-07:00
by HomerJohnston
It seems that IM is getting the correct alpha in the output image, but it is not getting the correct colors. It is interpreting the PSD colors as if a white background was added to the file, whereas ideally it should just be interpreting the colors which are there (forgive me if I am stating the obvious).

This is how it *is* interpreting the colors:
http://gyazo.com/ecc3723ff5a0e8e948ae3dfb3c12c069

This is how it *should* interpret the colors, ideally:
http://gyazo.com/eb1c281715153e01b685e5ac1d3229e5

Re: PSD transparency issue (ImageMagick adding white to transparent areas)

Posted: 2014-12-18T09:55:33-07:00
by dlemstra
The image created is the 'merged' image that is created by Photoshop. PSD files have a block at the end of the file that contains the 'combined' image. I am not sure why that is incorrect but you can get the 'correct' image if you flatten the layers yourself:

Code: Select all

convert test.psd -delete 0 -background none -flatten test.png

Re: PSD transparency issue (ImageMagick adding white to transparent areas)

Posted: 2014-12-18T16:40:46-07:00
by HomerJohnston
Seems to work great, thank you very much for both the explanation and a solution!