converting cmyk tif with background transparency to rgb tiff
- 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
My point is that only PS shows the transparency. That is a problem, if other viewers including IM do not show the transparency. That is why this is an IM bug.
EDIT: Also your command produces the wrong colors when viewed in PS (orange rather than brown), though it looks fine in other viewers, except the transparency is gone as in not showing in those viewers (white rather than transparent)
EDIT: Also your command produces the wrong colors when viewed in PS (orange rather than brown), though it looks fine in other viewers, except the transparency is gone as in not showing in those viewers (white rather than transparent)
Re: converting cmyk tif with background transparency to rgb tiff
I know there exists such tif. But I don't think it can be said it is definitely IM bug at least for display. Because it is not a tiff standard.fmw42 wrote:My point is that only PS shows the transparency. That is a problem, if other viewers including IM do not show the transparency. That is why this is an IM bug.
When converting, there should be a way to handle it somehow.
Convert from tif, your are right. But i said it again, what i wrote is convert from psd. It looks brown in PS.fmw42 wrote: EDIT: Also your command produces the wrong colors when viewed in PS (orange rather than brown), though it looks fine in other viewers, except the transparency is gone as in not showing in those viewers (white rather than transparent)
If you see still orange when converting from psd, it might be a Photoshop version difference.
- 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
No, the problem is not with PS, but with IM conversion of the TIFF.
Re: converting cmyk tif with background transparency to rgb tiff
i am talking about this commandfmw42 wrote:No, the problem is not with PS, but with IM conversion of the TIFF.
viewtopic.php?f=1&t=28259&start=15#p125385
Is this conversion result orange tiff in Photoshop?
- 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
see viewtopic.php?f=1&t=28259&start=15#p125405
There is no PSD in this topic. You may have converted to PSD in PS, but that is irrelevant to this issue. The issue has to do with conversion of CMYK TIFF to sRGB TIFF in IM. By converting to PSD in PS, you have avoided the issue and probably get correct results. Once it is PSD, IM may not have any problems.
There is no PSD in this topic. You may have converted to PSD in PS, but that is irrelevant to this issue. The issue has to do with conversion of CMYK TIFF to sRGB TIFF in IM. By converting to PSD in PS, you have avoided the issue and probably get correct results. Once it is PSD, IM may not have any problems.
Re: converting cmyk tif with background transparency to rgb tiff
OK I'd like to know if this work in your environment, because you said "it doesn't work" without any quote.
But when transparency lock issue would be fixed, it could be correct conversion will be archived without Photoshop.
And remember the contents of tiff 37742 tag is almost like a psd format. And therefore, tiff.c relies on psd.c. So you cannot say it is totally irrelevant. Currently, psd to tiff succeeded, but equivalent tiff to tiff failed. I think It is good starting point to check the source code.
I did not say that worked. I only said that can strip xmp metadata.fmw42 wrote:see viewtopic.php?f=1&t=28259&start=15#p125405
Yes, but look carefully. Currently I need Photoshop to do this conversion.fmw42 wrote: There is no PSD in this topic.
But when transparency lock issue would be fixed, it could be correct conversion will be archived without Photoshop.
And remember the contents of tiff 37742 tag is almost like a psd format. And therefore, tiff.c relies on psd.c. So you cannot say it is totally irrelevant. Currently, psd to tiff succeeded, but equivalent tiff to tiff failed. I think It is good starting point to check the source code.
Re: converting cmyk tif with background transparency to rgb tiff
It does not convert it to RGB at all.wellyman1 wrote:should I go back to approaching it this way? it did produce the desired result
convert Original.tif -alpha off /Users/tewellman/profiles/sRGB.icc -alpha on rgbout6.tif
Code: Select all
> identify rgbout6.tif
rgbout6.tif[0] TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 12.63MB 0.016u 0:00.006
rgbout6.tif[1] TIFF 1140x696 1140x696+30+252 8-bit CMYK 12.63MB 0.000u 0:00.010
rgbout6.tif[2] TIFF 1x1 1x1+0+0 16-bit Grayscale Gray 12.63MB 0.000u 0:00.020
rgbout6[0] is exactly same as Original.tif[0]. No conversion is performed.
Code: Select all
> compare -quiet -metric PSNR Original.tif[0] rgbout6.tif[0] null:
1.#INF
- 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
Thanks for your tests, but see viewtopic.php?f=3&t=28281#p125416.
Re: converting cmyk tif with background transparency to rgb tiff
Interesting. Inspired from magick's suggestion, my current solution would be:
Then It becomes to standard tiff.
Code: Select all
convert -quiet Original.tif psd:- | convert - -gravity center -compose CopyOpacity -composite +profile xmp +profile tiff:37724 -profile sRGB.icc o.tif
Re: converting cmyk tif with background transparency to rgb tiff
If I open the original in photoshop and save it without layers with transparency I can convert it fine with
If I open the original in photoshop and save it with layers with transparency I get the orange color when I try to convert.
To get it to work with layers, I convert to psd then to tif
Of course all of these examples are based on me opening the file in photoshop and saving it out with transparency, which I think is giving it a true alpha channel.
https://www.dropbox.com/s/ljwpz1dwklr02 ... x.png?dl=0
https://www.dropbox.com/s/nskckwrf15jnx ... x.tif?dl=0
https://www.dropbox.com/s/64nkhao1a4t8p ... x.tif?dl=0
Code: Select all
convert orig_saved_wo_layers_w_tx.tif -profile /Users/tewellman/profiles/sRGB.icc orig_saved_wo_layers_w_tx_out.tif
Code: Select all
convert orig_with_layers_w_tx.tif -profile /Users/tewellman/profiles/sRGB.icc orig_with_layers_w_tx_out.tif
Code: Select all
convert orig_with_layers_w_tx.tif -profile /Users/tewellman/profiles/sRGB.icc orig_with_layers_w_tx_out.psd
convert orig_with_layers_w_tx_out.psd orig_with_layers_w_tx_out.tif
https://www.dropbox.com/s/ljwpz1dwklr02 ... x.png?dl=0
https://www.dropbox.com/s/nskckwrf15jnx ... x.tif?dl=0
https://www.dropbox.com/s/64nkhao1a4t8p ... x.tif?dl=0
- 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
That is a good thought. But it loses the proper transparency. The transparency is only outside the whole rectangle of the logo and does not properly mask the boundary of the logo.246246 wrote:Interesting. Inspired from magick's suggestion, my current solution would be:Then It becomes to standard tiff.Code: Select all
convert -quiet Original.tif psd:- | convert - -gravity center -compose CopyOpacity -composite +profile xmp +profile tiff:37724 -profile sRGB.icc o.tif
See my solution at viewtopic.php?f=3&t=28281#p125416. The direct method fails, but if one saves the two images and does another convert on them it works. Cleaning my code up, it becomes
Code: Select all
convert -quiet -respect-parenthesis Original.tif \
\( -clone 1 +profile tiff:37724 -alpha extract \( -size 1200x1200 xc:black \) \
+swap -layers merge +repage +write tmp1.png \) \
\( -clone 0 +profile tiff:37724 -alpha off \
-profile /Users/fred/images/profiles/USWebCoatedSwop.icc \
-profile /Users/fred/images/profiles/sRGB.icc +repage +write tmp2.png \) \
null:
convert tmp2.png tmp1.png -alpha off -compose copy_opacity -composite -define tiff:alpha=associated result.tif
- 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
This works now as one command.
Code: Select all
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
Re: converting cmyk tif with background transparency to rgb tiff
I was able to run this successfully.
Re: converting cmyk tif with background transparency to rgb tiff
Thanks for all the help! This looks promising but I am not out of the woods yet. I am eventually going to incorporate this into a Magick.net app where the user provides files. So I will not know the number of layers before hand.
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
I am using this as a test and am not getting the desired result.
https://www.dropbox.com/s/ufsv534m6g1ud ... r.tif?dl=0
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
I am using this as a test and am not getting the desired result.
https://www.dropbox.com/s/ufsv534m6g1ud ... r.tif?dl=0
- 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
Sorry, I cannot answer your question about modifying the code above, because my old PS (CS) will not open that file saying it is not a valid text layer. Probably my old PS is just too old for this type of TIFF.
With this new file, identify lists 3 layers.
identify orig_multi_layer.tif
orig_multi_layer.tif[0] TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 6.583MB 0.000u 0:00.000
orig_multi_layer.tif[1] TIFF 1140x696 1140x696+30+252 8-bit CMYK 0.000u 0:00.000
orig_multi_layer.tif[2] TIFF 596x208 596x208+291+382 8-bit CMYK 0.000u 0:00.000
With your previous file, it lists two layers, because (I think) it is due to the transparency.
If you had no transparency, you would get one layer.
But I do not know how to detect if you have two layers whether it is transparent or not other than
You can see this way which layers have transparency or not.
With this new file, identify lists 3 layers.
identify orig_multi_layer.tif
orig_multi_layer.tif[0] TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 6.583MB 0.000u 0:00.000
orig_multi_layer.tif[1] TIFF 1140x696 1140x696+30+252 8-bit CMYK 0.000u 0:00.000
orig_multi_layer.tif[2] TIFF 596x208 596x208+291+382 8-bit CMYK 0.000u 0:00.000
With your previous file, it lists two layers, because (I think) it is due to the transparency.
If you had no transparency, you would get one layer.
But I do not know how to detect if you have two layers whether it is transparent or not other than
Code: Select all
convert -quite orig_multi_layer.tif -format "%[channels] %A %[type]\n" info:
cmyk False ColorSeparation
cmyka True ColorSeparationAlpha
cmyka True ColorSeparationAlpha