converting cmyk tif with background transparency to rgb tiff

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?".
wellyman1
Posts: 10
Joined: 2015-08-25T13:46:06-07:00
Authentication code: 1151

Re: converting cmyk tif with background transparency to rgb tiff

Post by wellyman1 »

My goal is to reliably process tifs with standard transparency as part of my workflow and not have the proprietary adobe transparency interfere with color conversions.

To achieve this

1. since tiff:37724 is proprietary to adobe and contains layer and transparency info specific to adobe I will remove it.

2. When single layer Photoshop tiffs that do not have true alpha are processed by IM transparency will be lost.

https://www.dropbox.com/s/s7vmg997dzeb2b3/orig.tif?dl=0

3. When multi layer Photoshop tiffs that do not have true alpha are processed by IM the background transparency will be lost, and the layers will appear to be flattened.

https://www.dropbox.com/s/ufsv534m6g1ud ... r.tif?dl=0

4. When single layer Photoshop tiffs that have true alpha are processed by IM the transparency will be maintained.

https://www.dropbox.com/s/v3gb059s83oul ... a.tif?dl=0

5. When multi layer Photoshop tiffs that have true alpha are processed by IM the transparency will be maintained, and the layers will appear to be flattened.

https://www.dropbox.com/s/041nrpon2rtm2 ... a.tif?dl=0

Is this the proper way to approach it? I am running tests now, so far they look good.


convert orig.tif +profile tiff:37724 -profile /Users/tewellman/profiles/sRGB.icc orig_out.tif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: converting cmyk tif with background transparency to rgb tiff

Post by fmw42 »

2. When single layer Photoshop tiffs that do not have true alpha are processed by IM transparency will be lost.
I cannot answer all your questions because i cannot open your multilayer tifs in my old PS. But for question 2, my code above will preserve your transparency.

I do not know what you mean by true alpha? Do you mean background transparency vs alpha channel transparency?

Your first three images appear to me to be identical when opened in PS. So I do not understand the difference between question 1 and 2 and 3.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: converting cmyk tif with background transparency to rgb tiff

Post by 246246 »

wellyman1 wrote: How would I modify this command to account for when a tiff has multiple layers?

convert -quiet -respect-parenthesis Original.tif \
\( -clone 0 -evaluate set 0 \) \
\( -clone 1 -alpha extract \) \
\( -clone 2 -clone 3 -layers merge +repage \) \
-delete 2,3 \
\( -clone 0 +profile tiff:37724 -alpha off \
-profile /Users/fred/images/profiles/USWebCoatedSwop.icc \
-profile /Users/fred/images/profiles/sRGB.icc +repage \) \
-delete 0,1 \
+swap -alpha off -compose copy_opacity -composite \
-define tiff:alpha=associated \
Original_srgb.tif
You need to extract alpha from multiple layers. As your layer has transparent background (except for [0]), so,

convert -respect-parenthesis orig_multi_layer.tif \
\( -clone 0 -evaluate set 0 \) \
\( -clone 1--2 -background none -layers merge -alpha extract \) \
\( -clone -2 -clone -1 -layers merge +repage \) \
-delete -2,-3 \
\( -clone 0 +profile tiff:37724 +profile xmp -alpha off -profile sRGB.icc +repage \) \
-delete 0--3 \
+swap -alpha off -compose copy_opacity -composite \
-define tiff:alpha=associated \
orig_multi_layer_rgb.tif

would work. (Layers becomes flatten but I think you want this kind of tiff as you seems to wanted to remove adobe propriety. To get RGB tiff with adobe layers, one have to rewrite tiff:37724 tag, but it is not supported with current ImageMagick. viewtopic.php?f=1&t=26785&start=15#p124776 )

As snibgo suggests, you may also remove xmp metadata, otherwise result has CMYK metadata whereas it is RGB. And your file include CMYK icc profile, I omit -profile USWebCoatedSwop.icc.

PS
Your layer[2] (text TEST) is completely included in layer[1] area, so I suggest it would be better test file if you move layer[2] upwards.
Post Reply