Convert TIFF to PSD and keep transparency

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?".
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Convert TIFF to PSD and keep transparency

Post by jansuhr »

I have a workflow that receives TIFF-files now and then and I need to save them to PSD.

First I have tried to find TIFF-files with transparency by using this command:

Code: Select all

convert infile.tif -format %[opaque] info:
But this will give the answer true for both transparent and non-transparent files

Secondly I have tried to convert the TIFF-files to PSD and to keep the transparency if there is any.
I have searched this forum for clues on how to do this but none of them have worked.

The TIFF-files have a layer to be able to save them with transparency from PhotoShop but what ever I try they get a white background.

Thanks

Jan
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert TIFF to PSD and keep transparency

Post by snibgo »

As far as I know, %[opaque] accurately says whether or not all the pixels are fully opaque. Perhaps you are talking about something else, where pixels are opaque but transparency is recorded in some other way.

Please provide a sample TIFF with the problem.
snibgo's IM pages: im.snibgo.com
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert TIFF to PSD and keep transparency

Post by snibgo »

The file contains two images. %opaque reports:

Code: Select all

f:\web\im>%IM%convert Tranparent-tif.tif -format "%[opaque]\n" info:

convert.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormal
Tag' @ warning/tiff.c/TIFFWarnings/887.

true
false
So it reports the first as fully opaque ("true"), but the second has transparency ("false"). "identify -verbose" says the same thing. When I convert each to a PNG, and examine these with Gimp, the first PNG is opaque while the second has a large central transparent rectangle.

Is this not correct, somehow?
snibgo's IM pages: im.snibgo.com
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

Well, it is saved from Photoshop as an TIFF with one layer and it has an central rectangle that is transparent. So that is correct.

That might also explain why I can not save it to a PSD with IM and keep the transparency.
Here is another one with a more obvious transparency.
https://dl.dropboxusercontent.com/u/687 ... parent.tif

Jan
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert TIFF to PSD and keep transparency

Post by snibgo »

Again, IM reports that we have two images. The first is opaque; the second has a transparent background (transparent white) around the figure.

The second image also has a page offset.

What command do you use to save it to PSD? I don't have Photoshop so can't test, but this should work:

Code: Select all

convert "CJ Pettersson transparent.tif[1]" +repage cj.psd
+repage removes the page offset. It should make no difference to the transparency.
snibgo's IM pages: im.snibgo.com
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

I get errors with that command:

Code: Select all

Jans-iMac:~ jannes$ convert "/Users/jannes/Desktop/CJ\ Pettersson\ transparent.tif[1]" /Users/jannes/Desktop/CJ\ Pettersson\ transparent2.psd
convert: unable to open image `/Users/jannes/Desktop/CJ\ Pettersson\ transparent.tif': No such file or directory @ error/blob.c/OpenBlob/2695.
convert: no images defined `/Users/jannes/Desktop/CJ Pettersson transparent2.psd' @ error/convert.c/ConvertImageCommand/3230.  
So by [1] you select the layer that is transparent?


Jan
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

When I run the command I only get one answer back:

Code: Select all

Jans-iMac:~ jannes$ convert /Users/jannes/Desktop/CJ\ Pettersson\ transparent.tif -format "%[opaque]\n" info:
convert: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/856.
true
It only sees the first one


Jan
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert TIFF to PSD and keep transparency

Post by snibgo »

You had a command with the error:
No such file or directory
Perhaps the backslash within the quotes is the problem there.

Only seeing the first image is strange. I am using IM v6.9.2-5, which is fairly recent. What version are you using?

EDIT:
jansuhr wrote:So by [1] you select the layer that is transparent?
Yes. There are two images. We get just the first with [0] or just the second with [1].
snibgo's IM pages: im.snibgo.com
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

I tried to remove the spaces but got the same error.

I have IM 6.9.1-10

Try to update and see if it gets better.

Jan
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

I'm installing with HomeBrew on my Mac and it seems that the latest they provide is 6.9.1-10
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert TIFF to PSD and keep transparency

Post by snibgo »

Try:

Code: Select all

identify "CJ Pettersson transparent.tif"
I get:

Code: Select all

CJ Pettersson transparent.tif[0] TIFF 1197x1277 1197x1277+0+0 8-bit sRGB 3.107MB 0.016u 0:00.015
CJ Pettersson transparent.tif[1] TIFF 1109x1149 1109x1149+58+128 8-bit sRGB 0.109u 0:00.116
identify.exe: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/887.
snibgo's IM pages: im.snibgo.com
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

I only get one:

Code: Select all

Jans-iMac:~ jannes$ identify /Users/jannes/Desktop/CJPetterssontransparent.tif 
/Users/jannes/Desktop/CJPetterssontransparent.tif TIFF 1197x1277 1197x1277+0+0 8-bit sRGB 3.107MB 0.000u 0:00.000
identify: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/856.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert TIFF to PSD and keep transparency

Post by snibgo »

Okay, your version of IM can see only one image. Mine can see two. Fred (fmw42) uses a Mac, so he may suggest how you can upgrade. He's in California, so currently asleep. And I have to go out. Back soon.
snibgo's IM pages: im.snibgo.com
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Convert TIFF to PSD and keep transparency

Post by jansuhr »

Thanks for you help so far.

If I do a identify on a PSD file, same file but as PSD it will show two images. But it is a PSD, totally different thing :-)


Jan
Post Reply