Page 1 of 1

possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-22T16:54:59-07:00
by fmw42
With regard to the post at viewtopic.php?f=1&t=23954, I believe the gist of the issue is as follows.

The input image at https://docs.google.com/file/d/0B8WNVy3 ... sp=sharing
is a CMYK .ai image with background transparency (according to Photoshop).


When converting from CMYK to sRGB using -colorspace, the resulting tif has transparency.

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


But when converting from CMYK to RGB (sRGB) using profiles, the resulting tiff has lost the transparency and has a white background.

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


Is this a bug or something that we do not understand about using profiles?

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-22T17:31:58-07:00
by magick
Add -verbose to your command line and you'll see the answer to your question. ImageMagick leverages Ghostscript to render Postscript, AI, PDF, etc., image files. The -colorspace sRGB option tells Ghostscript to use the PNGALPHA device which supports an alpha channel. Without this option, the logo.ai file is rendered as CMYK with the PAM output device. Although PAM should be able to support CMYKA, it apparently is not supported by Ghostscript. It would be grand if Ghostscript had an output device that supported all the various pixel formats such as RGB, RGBA, CMYK, and CMYKA-- but it doesn't.

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-22T18:11:28-07:00
by fmw42
So am I correct that one could edit the delegates.xml file from


<delegate decode="ps:cmyk" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pam" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>


to


<delegate decode="ps:cmyk" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

And that would work with profiles?


P.S. I would try that, but I seem to have several directories

/usr/local/etc/ImageMagick/delegates.xml
/usr/local/etc/ImageMagick-6/delegates.xml
/usr/local/etc/ImageMagick-6.8/delegates.xml
/usr/local/share/doc/ImageMagick/www/source/delegates.xml
/usr/local/share/doc/ImageMagick-6/www/source/delegates.xml
/usr/local/share/doc/ImageMagick-6.8/www/source/delegates.xml


Which is the correct one and can the other (similar directories) be deleted?

The resources page lists these as searched:

$MAGICK_CONFIGURE_PATH
$PREFIX/etc/ImageMagick
$PREFIX/share/ImageMagick-6.8.6
$HOME/.magick/
<client path>/etc/ImageMagick/

So does that mean the the first one found, namely, /usr/local/etc/ImageMagick/delegates.xml would be the one that is actually used?

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-22T18:17:36-07:00
by magick
Edit /usr/local/etc/ImageMagick-6/delegates.xml. Delete the others.

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-22T18:23:24-07:00
by fmw42
magick wrote:Edit /usr/local/etc/ImageMagick-6/delegates.xml. Delete the others.

Please clarify, since (while you were posting your answer) I edited my post above to show the load order from the resource page and it would appear from that, that the one to use would be $PREFIX/etc/ImageMagick = /usr/local/etc/ImageMagick

Does it stop at the first or last file in the resource list?

Thanks

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-23T04:15:21-07:00
by magick
/usr/local/etc/ImageMagick is left over from installing an older version of ImageMagick. The latest releases look for /usr/local/etc/ImageMagick-6.

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-23T10:23:44-07:00
by fmw42
Thanks.

So I should also delete /usr/local/etc/ImageMagick-6.8/ ?


Similarly for

/usr/local/share/doc/ImageMagick/www/source/delegates.xml
/usr/local/share/doc/ImageMagick-6/www/source/delegates.xml
/usr/local/share/doc/ImageMagick-6.8/www/source/delegates.xml

Just keep this ?

/usr/local/share/doc/ImageMagick-6

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-23T10:24:56-07:00
by magick
Yes. The location was changed based on recommendations from the Debian maintainers.

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-23T10:26:00-07:00
by fmw42
magick wrote:Yes. The location was changed based on recommendations from the Debian maintainers.

OK. Should the resource page be updated, which shows

$MAGICK_CONFIGURE_PATH
$PREFIX/etc/ImageMagick
$PREFIX/share/ImageMagick-6.8.6
$HOME/.magick/
<client path>/etc/ImageMagick/

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-23T11:51:01-07:00
by magick
Done.

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-23T13:29:33-07:00
by fmw42
To make the example work with profiles and maintain transparency. Do the following:

1) Edit your delegates.xml file in $PREFIX/etc/ImageMagick-6
(on my system that would be /usr/local/etc/ImageMagick-6/delegates.xml)

and change sDevice=pam to sDevice=pngalpha for ps:cmyk

<delegate decode="ps:cmyk" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

Save the file


2) run your command, such as

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


The result test.rgb.tif will not have a transparent background.

The above worked fine for me on IM 6.8.6.8 Q16. Note that the location for the delegates.xml file has changed as magick wrote above. So if you have an earlier version than 6.8.6.x it may be elsewhere in one of the directories I mentioned above. You should be able to locate all of the delegates.xml file using

find /usr | grep "delegates.xml"

Re: possible bug maintaining transparency IM 6.8.6.8 Q16

Posted: 2013-08-27T11:22:15-07:00
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'