rotation of a cmyk image breaks the black channel

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Jon

rotation of a cmyk image breaks the black channel

Post by Jon »

take a cmyk image (www.brickstores.com/misc/cmyktest.tif)

convert cmyktest.tif -rotate 45 output.tif

6.3.3-0 windows convert gives www.brickstores.com/misc/6.3.3.0-45.tif
(which is broken)

5.5.7 windows convert gives www.brickstores.com/misc/5.5.7-45.tif
(which is ok)

is there any interest in moving towards adding an extra real layer for the black channel (like r g b and opacity) so there is less special case stuff that has to be done?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

We can reproduce the problem you posted and will have a fix in ImageMagick 6.3.3-3 Beta by tommorrow.
Jon

Re: rotation of a cmyk image breaks the black channel

Post by Jon »

That fixed that problem but further probing cmyk and cmyka (alpha) images gives the following related bugs:

add an extra (mask) channel (www.brickstores.com/misc/cmyka.tif)
convert cmyka.tif -rotate 45 output.tif
the cmyk channels have been masked by the rotated alpha channel which is zeroed out.
(note that -rotate 90 works fine)

convert cmyka.tif -resize 150% output.tif
the cmyk channels have been masked by the alpha channel which is zeroed out.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

We cannot download cmyka.tif. We get a permission denied exception.
Jon

Re: rotation of a cmyk image breaks the black channel

Post by Jon »

Sorry, I uploaded it with a different name. I renamed it, try it now.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

We have a patch for the problem you reported. It will be available in ImageMagick 6.3.3-3 Beta sometime tommorrow.
Jon

Re: rotation of a cmyk image breaks the black channel

Post by Jon »

although the alpha channel is being preserved now after -rotate or -resize, it is being applied as a mask so the cmyk channels of the result are masked. is this correct? since the simplest case:
convert cmyka.tif out.tif
and
convert cmyka.tif -resize 100% out.tif
don't
and 5.5.7 didn't
this would seem to still be a bug.
teetanne

Re: rotation of a cmyk image breaks the black channel

Post by teetanne »

I have a similar problem. I want to convert a eps (CMYK with preview) to RGB-Jpeg. The conversation remove the black channel also.
The problem is still present at 6.3.3-5. Do you need a sample ?

Code: Select all

convert cymk.eps -colorspace RGB rgb.jpg
respects TeeTanne
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

Try this instead
  • convert -colorspace RGB cmyk.eps rgb.jpg
teetanne

Re: rotation of a cmyk image breaks the black channel

Post by teetanne »

Ok, the cmd line work.
I wrote a C++ program which I use to do the conversation automatically.
But it doesn't work with the release version of IM 6.3.3-5. The debug version do the conversation
and keep the black channel.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

We require a small code segment that we can download, run, and reproduce the problem. We will then tell you how to modify your code to achieve the desired result.
teetanne

Re: rotation of a cmyk image breaks the black channel

Post by teetanne »

You can download a VS project with a sample file (test.eps) from http://www.sports-space.de/colorspace/colorspace.zip
Before you compile it please edit the project file and apapt the path to your image magick installation.
The program will convert a cmyk-eps file to a rgb-jpeg file. Please run the program in debug and release mode. The debug version will generate a file "out_DB.jpg", respectively "out_RL.jpg" in release mode. Even when you start the debug mode the program throw a assert. I ignore the error alway.

Hopfully the code will help you.

respects TeeTanne
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

We put a patch in ImageMagick 6.3.3-7 Beta (available sometime tommorrow) to set the colorspace *before* you read the Postscript image. In your case, use:
  • image.colorspaceType(RGBColorspace);
    image.read(szFile);
Jon

Re: rotation of a cmyk image breaks the black channel

Post by Jon »

There are still seem to be a number of issues wrt rotating cmyk images:

why does:
convert cmyk.tif -rotate 45 6498a.tif
add an empty alpha channel

trying to use -background to control the added alpha channel i find:

why does:
convert -background #00000000 cmyk.tif -rotate 45 6498b.tif
add an empty alpha channel and make the black channel black in the part of the image outside the original image

why does:
convert -background #000000FF cmyk.tif -rotate 45 6498c.tif
add an alpha channel and make both the alpha channel and the black channel black in the part of the image outside the original image

i am using the 8bit static single thread windows version of 6.4.9-8
the files are available in:
http://www.brickstores.com/misc/cmyk.tif
http://www.brickstores.com/misc/6498a.tif
http://www.brickstores.com/misc/6498b.tif
http://www.brickstores.com/misc/6498c.tif
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: rotation of a cmyk image breaks the black channel

Post by magick »

why does:
convert cmyk.tif -rotate 45 6498a.tif
add an empty alpha channel
Image rotation uses a blend operator which requires an alpha channel. After the rotation, if are not interested in the alpha channel, add +matte to your command line to turn the alpha channel off.
why does:
convert -background #00000000 cmyk.tif -rotate 45 6498b.tif
add an empty alpha channel and make the black channel black in the part of the image outside the original image
The background color is legacy and therefore strictly RGB. To fix the background color, apply it as RGB and use -opaque to replace it in the image. The -opaque option accepts CMYK colors (e.g. cmyk(100,0,40,0)). You can also first convert the image to the RGB colorspace, rotate it, and then convert it back to CMYK. This is best done with a SWOP and sRGB color profile.
Post Reply