Page 1 of 4

converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-26T08:46:53-07:00
by wellyman1
I am having trouble converting a cmyk tif with background transparency to rgb. After the conversion it appears the black values are off and when opened in photoshop the visual is strange.

The goal is to have a proper conversion, maintain the transparent background and have the file appear normally when opened in photoshop (I am using CS6)

I am using ImageMagick-6.9.2-Q8 64 bit

and have tried

convert original.tif -colorspace rgb test2.tif

convert original.tif -channel cmyka -alpha on -colorspace rgb test3.tif

the files can be accessed here, any insight would be appreciated! thanks

original file
https://www.dropbox.com/s/pdgg8iht9o246 ... l.tif?dl=0

converted
https://www.dropbox.com/s/3097u3pgq4fye ... d.tif?dl=0 converted

what I see in photoshop
https://www.dropbox.com/s/8032e2sitzw4z ... p.png?dl=0 what I see in photoshop

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-26T09:32:03-07:00
by fmw42
This works fine for me in IM 6.9.2.0 Q16 Mac OSX. Note, your tiff seems to contain two layers according to IM identify -verbose, but Photoshop only shows one. When creating the TIF it was probably not save with layers rather than without. So the second layer may be the hidden transparency. The first layer has a USWebCoatedSwop CMYK profile, the second does not. So I use just the first layer via [0] and an sRGB profile to convert to sRGB.

Code: Select all

convert Original.tif[0] -profile /Users/fred/images/profiles/sRGB.icc Original_rgb.tif

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-26T13:32:31-07:00
by wellyman1
when I tried the command above I got the same result as before.

but this worked

convert Original.tif -alpha off /Users/tewellman/profiles/sRGB.icc -alpha on rgbout6.tif

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-26T13:52:20-07:00
by snibgo
wellyman wrote:convert original.tif -colorspace rgb test2.tif

convert original.tif -channel cmyka -alpha on -colorspace rgb test3.ti
You probably intended to converting to sRGB, instead of RGB. As Fred suggests, when you have a profile, convert with a profile, in this case sRGB.icc.

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-26T14:11:11-07:00
by fmw42
wellyman1 wrote:when I tried the command above I got the same result as before.
I would not expect it to work with my path to my profiles. You need to use your path to where you have your profiles located.

Perhaps an issue with Q8 IM?

What platform are you on?

You should not have to turn off and on transparency!

Try as in my command with the use of the first layer by using [0].

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-26T14:54:23-07:00
by 246246
fmw42 wrote:Note, your tiff seems to contain two layers according to IM identify -verbose, but Photoshop only shows one.
Slightly off topic, it is another case that detecting layer introduced in 6.9.1-4 failed.
See viewtopic.php?f=1&t=26785 and viewtopic.php?f=1&t=28045

Code: Select all

d:\tmp>identify -quiet Original.tif
Original.tif[0] TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 6.542MB 0.016u 0:00.017
Original.tif[1] TIFF 1140x696 1140x696+30+252 8-bit CMYK 0.000u 0:00.006

d:\tmp>identify -quiet Original.tif[0]
Original.tif[0]=>Original.tif TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 0.000u 0:00.000

d:\tmp>identify -quiet Original.tif[1]

d:\tmp>identify -quiet -format "%[tiff:has-layers]\n" Original.tif[0]
true
I will follow this case in viewtopic.php?f=1&t=28045&start=15#p125205

So, back to topic, If you are using the version before 6.9.1-4, [0] might not work.

Code: Select all

$ identify -version
Version: ImageMagick 6.9.1-3 Q16 i686 2015-07-01 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: DPC OpenMP
Delegates (built-in): autotrace bzlib cairo fftw fontconfig freetype fpx gslib jbig jng jpeg lcms lzma pangocairo png ps rsvg tiff webp x xml zlib

$ identify d:/tmp/Original.tif
d:/tmp/Original.tif TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 6.542MB 0.016u 0:00.017
identify: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/852.

$ identify -quiet d:/tmp/Original.tif
d:/tmp/Original.tif TIFF 1200x1200 1200x1200+0+0 8-bit CMYK 6.542MB 0.032u 0:00.018

$ identify -quiet d:/tmp/Original.tif[0]
identify: unable to open image `/tmp/Original.tif': No such file or directory @ error/blob.c/OpenBlob/2695.
identify: no decode delegate for this image format `D' @ error/constitute.c/ReadImage/501.
EDIT:
As it seems OP uses 6.9.2-0 so this is irrelevant. Sorry.

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-27T13:37:14-07:00
by wellyman1
I tried using layer 0, it did not work

Convert Original.tif[0] -profile /Users/tewellman/profiles/sRGB.icc Originalzeroout.tif


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

maybe I will download Q16 and compare

I am on Windows

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-27T14:42:32-07:00
by fmw42
That was just a warning and should be irrelevant to the processing of your image. Perhaps a Windows issue. It worked fine for me on Mac OSX and IM 6.9.2.0.

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T11:55:46-07:00
by wellyman1
When I save the image as a tiff without layers it converts successfully, Is there a way for Imagemagick to combine the layers into one and maintain transparency? when I look through the examples they are geared toward combining separate images not layers within an image. I suppose I could make a transparent background and compose it over that but then I would need to be able to programmatically detect if the image did have transparency, (as eventually this will be part of an application)

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T12:40:27-07:00
by fmw42
You can try

Code: Select all

convert Original.tif -background none -flatten -profile /Users/tewellman/profiles/sRGB.icc Originalzeroout.tif
or

Code: Select all

convert Original.tif -profile /Users/tewellman/profiles/sRGB.icc -background none -flatten Originalzeroout.tif
But I am not sure IM handles multilayer tiff files.

Your original file that you posted above earlier has only one layer with background transparency. It processed just fine for me. So I am puzzled why you cannot reproduce it.

Perhaps on of the Windows users can test it and see what happens.

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T14:53:50-07:00
by wellyman1
I tried the last two commands but no luck.
You make a good point about going back to

convert Original.tif[0] -profile sRGB.icc Original_rgb.tif

and seeing why I can't get it to work on windows

do I need to open another ticket to have some one look at it? Sorry I am new here so I don't have the process down. Thanks for all of your help with this!

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T15:46:48-07:00
by fmw42
Have you tried Q16 IM compile?

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T15:49:46-07:00
by fmw42
do I need to open another ticket to have some one look at it?
Generally no.

Hopefully one of the other windows users will see this and confirm one way or the other.

But if all else fails, you can open another topics and reference back to this.

If someone confirms that it does not work on Q8 and Q16 Windows, then you should report this on the Bugs forum.

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T16:04:44-07:00
by snibgo
I'll happily test something but I don't understand the problem.

If someone supplies an image file and command, and what should happen but what does happen, I'll give it a go.

Re: converting cmyk tif with background transparency to rgb tiff

Posted: 2015-08-29T16:21:03-07:00
by fmw42
wellyman1 wrote:I am having trouble converting a cmyk tif with background transparency to rgb. After the conversion it appears the black values are off and when opened in photoshop the visual is strange.
The original image is in the very first post at the top.

The following works for me just fine and looks like the original when I open it in Mac Preview and IM display and GraphicConverter, Safari, Firefox and Chrome.

Code: Select all

convert Original.tif[0] -profile /Users/fred/images/profiles/sRGB.icc Original_rgb.tif
Use your own path to sRGB.icc

However, now when I try again and open the IM result in my old Photoshop (CS), the colors are way off (the center brown section looks orange), even though it looks fine in the other views as above.

(perhaps IM is not writing something correctly in the xmp or tiff profile???)

Oddly, if I simply negate the image

Code: Select all

convert Original.tif[0] -negate Original_negated.tif
It looks fine in PS, but not in the other viewers.