Page 1 of 1

possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-29T17:15:38-07:00
by fmw42
See viewtopic.php?f=1&t=28259#p125363 and subsequent posts for best explanation. The original image is at the very first post in the topic.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-29T18:53:17-07:00
by magick
It looks like Photoshop displays the original CMYK colors, not the sRGB colors. To achieve, try
  • convert Original.tif -negate new.tif
    display new.tif
New.tif should show the same colors as your whatIseeinPhotoshop.png image. To convert to sRGB, use
  • convert Original.tif -negate -colorspace sRGB new.tif
    display new.tif
Those colors are very different because they are actually in the sRGB colorspace.

Why the negate? Because Photoshop has historically (and incorrectly) reversed the CMYK color values.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-29T19:12:31-07:00
by fmw42
magick wrote:convert Original.tif -negate -colorspace sRGB new.tif
This does not work for me. It still has the orange color rather than brown.

see viewtopic.php?f=1&t=28259&start=15#p125368

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-30T05:07:29-07:00
by magick
The CMYK colors appear to match those of whatIseeinPhotoshop.png so that's our baseline color values. For sRGB you would need a CMYK to sRGB color transform that matches that of Photoshop. Since there is a conflict with the associated color profiles, you can eliminate one or use your own. For example:
  • convert Original.tif +profile "*" -profile cmyk.icm -profile sRGB.icm new.tif
If that does not match, you likely do not have the same color profiles as Photoshop. Its also possible, Photoshop is pulling metadata from the XMP profile and perhaps adjusting the color values pre or post color transform.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-30T10:53:10-07:00
by fmw42
These two work by stripping all profiles as I said before

Code: Select all

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

Code: Select all

convert Original.tif[0] +profile "*" -profile /Users/fred/images/profiles/USWebCoatedSwop.icc -profile /Users/fred/images/profiles/sRGB.icc Original_rgb2.tif
But I cannot just strip the imbedded USWebCoatedSwop.icc profile and get it to work as follows:

Code: Select all

convert Original.tif[0] +profile "icc" -profile /Users/fred/images/profiles/USWebCoatedSwop.icc -profile /Users/fred/images/profiles/sRGB.icc Original_rgb2.tif

IM either needs to reset the Photoshop data to properly identify that it is then sRGB and not CMYK or it needs some way to strip the Photoshop data alone, so that any color profile and clip paths can remain.

I had tried +profile "xmp" and +profile "tiff", but neither of them worked. So the problem is in the photoshop data, which has no profile listed in the file. I do not know where that data is stored, but -strip or +profile "*" does get rid of it.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-30T11:13:49-07:00
by fmw42
CORRECTION: The above commands to strip profiles do work to get the colors correct, but the transparency is lost.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-30T21:35:08-07:00
by 246246
fmw42 wrote: I had tried +profile "xmp" and +profile "tiff", but neither of them worked. So the problem is in the photoshop data, which has no profile listed in the file. I do not know where that data is stored, but -strip or +profile "*" does get rid of it.
+profile "tiff" does nothing. You have to select from the following shown in idntify -verbose

...
Profiles:
Profile-8bim: 7414 bytes
Profile-icc: 557168 bytes
Profile-tiff:37724: 180740 bytes
Profile-xmp: 36672 bytes

+profile tiff:37724 will remove photoshop layer, but photoshop-only transparency information is also in it.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-30T23:27:52-07:00
by fmw42
Thanks for the information about +profile tiff:37724. But we need a way to remove the colorspace information in the photoshop data without destroying the transparency.

Re: possible bug converting CMYK tiff to RGB tiff

Posted: 2015-08-31T11:01:43-07:00
by fmw42
This finally works.

But it should not be necessary to for this to be so complicated. IM should do a proper conversion in a simple 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