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

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
HomerJohnston
Posts: 4
Joined: 2014-12-16T23:48:53-07:00
Authentication code: 6789

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

Post 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!
Last edited by HomerJohnston on 2014-12-18T16:41:51-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
HomerJohnston
Posts: 4
Joined: 2014-12-16T23:48:53-07:00
Authentication code: 6789

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

Post 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
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post 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
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
HomerJohnston
Posts: 4
Joined: 2014-12-16T23:48:53-07:00
Authentication code: 6789

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

Post by HomerJohnston »

Seems to work great, thank you very much for both the explanation and a solution!
Post Reply