Saving a TIFF losing alpha channe; in PhotoShop (CS5 and CS6

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Saving a TIFF losing alpha channe; in PhotoShop (CS5 and CS6

Post by tafkaks »

There is a similar topic in Bugs to mine that does not appear to be resolved. Basically, my situation is this:

I have a TIFF image produced by a 3d render (source.tif) which has an alpha channel. The alpha channel shows up in Photoshop and Gimp, and I can see that the file has an alpha channel if I use exiftool or identify.

If I simply save the tiff via convert:

convert source.tif dest.tif

Then dest.tif will have an alpha channel which shows up in gimp, identify, exiftool -- but not Photoshop. Photoshop shows only the RGB channels. Here are a links to the source and destination files:

http://dl.dropbox.com/u/5512/source.tif
http://dl.dropbox.com/u/5512/dest.tif

OS: Mac OSX 10.7.4
IM: ImageMagick 6.7.9-0 2012-09-22 Q16 http://www.imagemagick.org
libtiff: TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 3.9.5), TIFF64* TIFF --- Tagged Image File Format (64-bit) (LIBTIFF, Version 3.9.5)

Any help would be appreciated here -- I'm assuming there's *something* about the source file that causes the alpha channel to be invisible to PS, but I cannot determine what.

Thanx very much in advance -- mikey
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by magick »

We're using ImageMagick 6.7.9-10 and the destination TIFF includes the alpha channel as expected.
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

Hmmm -- no luck here. I built the latest from source with the same results:

convert --version
Version: ImageMagick 6.7.9-10 2012-10-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP OpenCL

EDIT:

I should point out that the problem only occurs when loading dest.tif into Photoshop. Gimp, identify, etc all show the alpha. As always, any ideas or help would be appreciated
Last edited by tafkaks on 2012-10-10T12:16:17-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: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by fmw42 »

tafkaks wrote:Hmmm -- no luck here. I built the latest from source with the same results:

convert --version
Version: ImageMagick 6.7.9-10 2012-10-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP OpenCL
What happens if you disable OpenMP and OpenCL?

I have no trouble with keeping the alpha channel in IM 6.7.9.10 Q16 Mac OSX Snow Leopard with those disabled:


convert source.tif source2.tif

identify -verbose source2.tif
Image: source2.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 256x256+0+0
Resolution: 150x150
Print size: 1.70667x1.70667
Units: PixelsPerInch
Type: TrueColorAlpha
Base type: TrueColor
Endianess: MSB
Colorspace: sRGB
Depth: 16-bit
Channel depth:
red: 16-bit
green: 16-bit
blue: 16-bit
alpha: 16-bit
Channel statistics:
Red:
min: 0 (0)
max: 65535 (1)
mean: 8481.4 (0.129418)
standard deviation: 13560.3 (0.206918)
kurtosis: -0.200077
skewness: 1.20232
Green:
min: 0 (0)
max: 55475 (0.846494)
mean: 5692.73 (0.0868656)
standard deviation: 9283.94 (0.141664)
kurtosis: 0.512094
skewness: 1.35793
Blue:
min: 0 (0)
max: 47775 (0.729)
mean: 3098.5 (0.04728)
standard deviation: 5279.75 (0.0805638)
kurtosis: 3.3635
skewness: 1.75623
Alpha:
min: 0 (0)
max: 65535 (1)
mean: 21554.7 (0.328904)
standard deviation: 30747.2 (0.469173)
kurtosis: -1.46704
skewness: -0.728392
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

Platform is OSX 10.7.4.

Rebuilding with both openmp and opencl has no effect:

convert --version
Version: ImageMagick 6.7.9-10 2012-10-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

I can actually see the alpha channel via identify (and gimp) as well. This issue appears to lie with Photoshop only. Unfortunately for me, it's what PS sees that counts .
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by fmw42 »

tafkaks wrote:I can actually see the alpha channel via identify (and gimp) as well. This issue appears to lie with Photoshop only. Unfortunately for me, it's what PS sees that counts .
Both source.tif and and my processed source2.tif show an Alpha 1 transparency channel in my old PS CS. Note that this alpha transparency is different from PS background transparency for which I see no evidence for either image.
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

Can you tell me what version of PS you're using? It's definitely missing in mine. Here's the layers panel (channel tab) for the source image:

Image

Here's the same panel for the destination image:

Image

As you can see, the alpa channel seems missing.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by fmw42 »

I am using a very old PS CS (equivalent to version 8 according to the About PS panel).
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

That may account for the difference. It's possible that libtiff is the culprit here (well, I suspect PS is the *real* culprit). I have also attempted the same operation with other software and gotten the same results. I'll try out the libtiff utilities later and report back.

The data in both files is identical, but the IM version contains 5 additional IFD entries, and the strip layout seems to be subdivided differently. The actual image data, though, is identical in both files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by fmw42 »

From your pictures, it looks like the alpha channel has been converted to background transparency in the PS version you are using. You can see that from the checkerboard pattern. Perhaps there is some setting in the new PS that allows you to control whether an alpha channel is converted to background transparency or not. Or perhaps that is now the way PS works. Though that would be odd, since it should allow multiple alpha channels. Check the PS preferences or the import panel when you try to Open an image and see if there is a setting there.
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

Right -- but this only seems to happen with tiffs written out by imagemagick. I can use the libtiff tools (tiffcrop, tiffcp, etc) to generate tiffs that do not do this.

Having said all that, my workaround is simple enough -- output my finished image directly to psd. There's no real requirement that I output tiffs -- only that I can take them as input (I'm reassembling a larger image from a set of smaller images).

Something is clearly up with latter versions of photoshop and tif files, though. Might be worth the dev team taking a look either way
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by fmw42 »

Create a tiff in PS. Then convert it with IM. Then compare the tiff data in the two files using each of IM identify -verbose, tiffinfo and exiftool. Look to see if there is some change in the code for the type of transparency, i.e., background vs alpha. I believe they have different names or numbers. It has been too long since I tried that, I do not remember. Sorry I do not have a current enough PS to test with.

P.S. Did you look to see if there was some preference or reading option that might allow you to change the type of transparency?
tafkaks
Posts: 12
Joined: 2012-10-10T06:34:28-07:00
Authentication code: 67789

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by tafkaks »

There are differences betweenthe output of exifdata for both, but nothing relating to alpha. Here's a diff between exiftool -verbosr runs for both. Photoshop-saved tiff was on the right hand side (>):

Code: Select all

<   FileName = Helmet_im.tif
---
>   FileName = Helmet_ps.tif
4,6c4,7
<   FileSize = 33593666
<   FileModifyDate = 1350050674
<   FileAccessDate = 1350052442
---
>   FileSize = 33577264
>   ResourceForkSize = 63747
>   FileModifyDate = 1350050494
>   FileAccessDate = 1350052382
12,31c13,31
<   | 0)  ImageWidth = 2048
<   | 1)  ImageHeight = 2048
<   | 2)  BitsPerSample = 16 16 16 16
<   | 3)  Compression = 1
<   | 4)  PhotometricInterpretation = 2
<   | 5)  FillOrder = 1
<   | 6)  DocumentName = Helmet_im.tif
<   | 7)  StripOffsets = 8 16392 32776 49160 65544 81928 98312 114696 131080 147464 16384[snip]
<   | 8)  Orientation = 1
<   | 9)  SamplesPerPixel = 4
<   | 10) RowsPerStrip = 1
<   | 11) StripByteCounts = 16384 16384 16384 16384 16384 16384 16384 16384 16384 16384 1[snip]
<   | 12) PlanarConfiguration = 1
<   | 13) PageNumber = 0 1
<   | 14) Software = Adobe Photoshop CS6 (Macintosh)
<   | 15) ModifyDate = 2012:10:12 09:01:27
<   | 16) WhitePoint = 0.3127000035 0.3289999963 (1343036288/4294967295 1413044224/4294967295)
<   | 17) PrimaryChromaticities = 0.6399999858 0.3300000132 0.300000012 0.600000024 0.150[snip]
<   | 18) ExtraSamples = 2
<   | 19) ApplicationNotes (SubDirectory) -->
---
>   | 0)  SubfileType = 0
>   | 1)  ImageWidth = 2048
>   | 2)  ImageHeight = 2048
>   | 3)  BitsPerSample = 16 16 16 16
>   | 4)  Compression = 1
>   | 5)  PhotometricInterpretation = 2
>   | 6)  StripOffsets = 22788
>   | 7)  Orientation = 1
>   | 8)  SamplesPerPixel = 4
>   | 9)  RowsPerStrip = 2048
>   | 10) StripByteCounts = 33554432
>   | 11) XResolution = 0 (0/10000)
>   | 12) YResolution = 0 (0/10000)
>   | 13) PlanarConfiguration = 1
>   | 14) ResolutionUnit = 2
>   | 15) Software = Adobe Photoshop CS6 (Macintosh)
>   | 16) ModifyDate = 2012:10:12 09:01:27
>   | 17) ExtraSamples = 0
>   | 18) ApplicationNotes (SubDirectory) -->
54c54
<   | 20) PhotoshopSettings (SubDirectory) -->
---
>   | 19) PhotoshopSettings (SubDirectory) -->
87a88,92
>   | 20) ExifOffset (SubDirectory) -->
>   | + [ExifIFD directory with 3 entries]
>   | | 0)  ColorSpace = 65535
>   | | 1)  ExifImageWidth = 2048
>   | | 2)  ExifImageHeight = 2048
There's really nothing nothing in the diff here that references the alpha channel directly. identify -verbose reveals even fewr differences:

Code: Select all

c1
< Image: Helmet_im.tif
---
> Image: Helmet_ps.tif
73,74c73,74
<     date:create: 2012-10-12T09:04:34-05:00
<     date:modify: 2012-10-12T09:04:34-05:00
---
>     date:create: 2012-10-12T09:01:34-05:00
>     date:modify: 2012-10-12T09:01:34-05:00
75a76,77
>     exif:PixelXDimension: 2048
>     exif:PixelYDimension: 2048
79d80
<     tiff:document: Helmet_im.tif
96c97
<     filename: Helmet_im.tif
---
>     filename: Helmet_ps.tif
99c100
<   Filesize: 33.59MB
---
>   Filesize: 33.58MB
I haven't pursued special loading options for PS, as this doesn't really help us for this application. In any case, the workaround seems to be to convert to PSD. Even the "broken" tiff from IM has a proper alpha channel in Photoshop if IM is used to convert it to a psd. You can even pass -set label "foo" to give the layer a name. This is fine for us. Thanks again for the attempts, though. TIFF just seems generally tricky.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Saving a TIFF losing alpha channe; in PhotoShop (CS5 and

Post by fmw42 »

Post Reply