Undefined conversion from CMYK to RGB using a vector image

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?".
Post Reply
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Undefined conversion from CMYK to RGB using a vector image

Post by eduardo.melgar »

I have an automated task for CMYK-to-RGB conversion. I am using a Vector file. By running identify on it I can extract the color space of the image (CMYK) but since the image hasn't any color profile I have to define a standard in-profile and then a out-profile. The original image is a text in white with a transparent background. Base on the transparency I apply an additional trim to get rid off unnecessary transparent pixels.
My command then should be (ideally):

convert -size 840x680 -density 300 -auto-level logo.ai -trim +repage -profile ~/icc/EuroscaleUncoated.icc -profile ~/icc/sRGBProfile.icm test_none.tif

The resulting image misses its transparency (white background) and the text is not longer visible (because of the white background)
Then, I run this command instead:

convert -size 840x680 -density 300 -auto-level -colorSpace RGB logo.ai -trim +repage -profile ~/icc/EuroscaleUncoated.icc -profile ~/icc/sRGBProfile.icm test_rgb.tif

In this case the image is (as expected) transparent and the text is visible. But the original image is not RGB and when I try to use "-colorSpace CMYK" instead of "RGB" or "sRGB" the resulting image is without transparency again.
I tested the same approach with PDF files and found the same issue: transparency only when defining the files as RGB or sRGB.
Any idea of how ImageMagick is preforming the conversion? Why the image is missing its transparency?

Link to test images:
AI: https://docs.google.com/file/d/0B8WNVy3 ... sp=sharing
PDF: https://docs.google.com/file/d/0B8WNVy3 ... sp=sharing

Versions:
ImageMagick: 6.7.7-10
OS: Ubuntu 13.04 32b
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Undefined conversion from CMYK to RGB using a vector ima

Post by fmw42 »

First, this post should be moved to the Users forum, since it is a question about IM and not image processing in general. The Forum Admin will move it.

Your ai and pdf images (as downloaded) have no transparency in them. IM identifies them as CMYK and not CMYKA. IM sees no transparency channel. Verify that your downloaded images are the same as the ones you thought you uploaded.

I do not have your two profiles, but I substituted similar one. These two commands work fine. I do not think -size does anything in this context and -auto-level is not needed, but if it were to be used it should come after reading the input.

These are the two proper commands syntax for your case with no imbedded profile.


convert -density 300 logo.ai -trim +repage -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc test_rgb.tif

convert -density 300 sizes.pdf -trim +repage -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc test2_rgb.tif
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Undefined conversion from CMYK to RGB using a vector ima

Post by eduardo.melgar »

Hi, can you to run the commands I passed to you with the files I linked?
As I said, the files are vector images. That means the "images" are vectors and the rest is "no-vector" graphic, meaning empty (transparent). If you open these files in Photoshop you will see the transparency.
After you run the commands (I understand there are some unnecessary parameters) and open the files, "test_rgb.tif" will show the transparency but "test_none.tif" has a white background.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Undefined conversion from CMYK to RGB using a vector ima

Post by fmw42 »

Your two files have "bacgkround" transparency according to Photoshop. Currently, IM does not usually recognize background transparency and only sees alpha channel transparency in general. That might explain why you get no output transparency in your tiff.

Your first command makes no sense. You cannot convert to RGB via -colorspace RGB and then use the input profile for CMYK. When I run your command or my version as above adding -colorspace RGB, I get an error message

convert -size 840x680 -density 300 -auto-level -colorSpace RGB logo.ai -trim +repage -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc test_rgb.tif

convert: color profile operates on another colorspace `icc' @ error/profile.c/ProfileImage/780.

However, the image is produced and does have transparency

Removing the profiles produces a transparent result with no error message

convert -density 300 -colorSpace RGB logo.ai -trim +repage test2_rgb.tif

But the following does not save the transparency when using only profiles.

convert -density 300 logo.ai -trim +repage -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc test_rgb.tif

I have posted a bug report in the Bugs forum at viewtopic.php?f=3&t=23957
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Undefined conversion from CMYK to RGB using a vector ima

Post by fmw42 »

The solution is posted in the bug report listed above.
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Undefined conversion from CMYK to RGB using a vector ima

Post by eduardo.melgar »

Thank you. I did as explained and finally got the required transparency. But after I changed the setting, color space is not correctly described by identify.

Running following command:

$ identify -verbose profile_USWCv2.eps

Here, the original description (correct):

Image: profile_USWCv2.eps
Format: EPT (Encapsulated PostScript with TIFF preview)
Class: DirectClass
Geometry: 535x355+0+0
Base geometry: 2231x1480
Resolution: 300x300
Print size: 1.78333x1.18333
Units: Undefined
Type: ColorSeparation
Base type: ColorSeparation
Endianess: Undefined
Colorspace: CMYK
Depth: 16/8-bit
...
Profiles:
Profile-icc: 557168 bytes
Description: U.S. Web Coated (SWOP) v2
Manufacturer: U.S. Web Coated (SWOP) v2
Model: U.S. Web Coated (SWOP) v2
Copyright: Copyright 2000 Adobe Systems, Inc.

Here the new identify-description (incorrect)

Image: profile_USWCv2.eps
Format: EPT (Encapsulated PostScript with TIFF preview)
Class: DirectClass
Geometry: 535x355+0+0
Base geometry: 2231x1480
Resolution: 300x300
Print size: 1.78333x1.18333
Units: Undefined
Type: TrueColorAlpha
Endianess: Undefined
Colorspace: sRGB
...
Profiles:
Profile-icc: 557168 bytes
Description: U.S. Web Coated (SWOP) v2
Manufacturer: U.S. Web Coated (SWOP) v2
Model: U.S. Web Coated (SWOP) v2
Copyright: Copyright 2000 Adobe Systems, Inc.


As you can see, the file is definitely CMYK (with embedded profile), but 'identify' mark it as 'sRGB'
Post Reply