Convert cmyk jpg with -sharpen param damage image colors

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
User avatar
lukasruzicka
Posts: 3
Joined: 2016-04-07T06:47:00-07:00
Authentication code: 1151

Convert cmyk jpg with -sharpen param damage image colors

Post by lukasruzicka »

Hi,
I probably found bug, when you try to convert cmyk jpeg image and sharpen param is used.

Code: Select all

Version: ImageMagick 6.9.3-1 Q16 x86_64 2016-01-22 http://www.imagemagick.org
Origin image: https://www.dropbox.com/s/0i3i4uzma0y54 ... n.jpg?dl=0

Command, i have used:

Code: Select all

convert cmyk.jpg -thumbnail '1000x1000>' -background white -gravity center  -sharpen 0x0.1 -background white -quality 88 -colorspace sRGB converted.jpg
Result of conversion: https://www.dropbox.com/s/0ykgshyq7jvq0 ... d.jpg?dl=0

If i remove the -sharpen 0x0.1 parameter, it looks better.

Code: Select all

 convert cmyk.jpg -thumbnail '1000x1000>' -background white -gravity center -background white -quality 88 -colorspace sRGB converted.jpg
You can see the result here: https://www.dropbox.com/s/7umtms13l3wur ... n.jpg?dl=0

Older imagick (ImageMagick 6.7.2-7 2015-07-23 Q16) on another server gives me proper results.

Thanks for help.

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

Re: Convert cmyk jpg with -sharpen param damage image colors

Post by magick »

ImageMagick is likely sharpening the black channel. Try removing the black channel from the sharpening operation with the -channel CMY option.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert cmyk jpg with -sharpen param damage image colors

Post by fmw42 »

I suspect that IM does not process things like -sharpen etc well in CMYK colorspace. I would suggest you convert to sRGB right after reading the input. Best to use profiles.

Both these work for me (unix syntax)

Code: Select all

convert origin.jpg \
-profile /Users/fred/images/profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
-thumbnail '1000x1000>' -background white -gravity center \
-sharpen 0x0.1 -background white -quality 88 converted.jpg

Code: Select all

convert origin.jpg \
-colorspace sRGB \
-thumbnail '1000x1000>' -background white -gravity center \
-sharpen 0x0.1 -background white -quality 88 converted2.jpg
Post Reply