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

converting cmyk tif with background transparency to rgb tiff

Post 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
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 »

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
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 »

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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting cmyk tif with background transparency to rgb tiff

Post 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.
snibgo's IM pages: im.snibgo.com
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 »

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].
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 »

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.
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 »

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
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 »

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.
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 »

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)
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 »

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.
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 »

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!
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 »

Have you tried Q16 IM compile?
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 »

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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting cmyk tif with background transparency to rgb tiff

Post 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.
snibgo's IM pages: im.snibgo.com
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 »

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.
Post Reply