Page 1 of 1

What causes images to be rendered dark?

Posted: 2012-05-01T12:50:21-07:00
by hexmode
From this bug report:

This image looks ok: Image

But if you take the 263px version (size for inside a dutch infobox, the image
seems to be rendered completely wrong (darker):

Image

Did something go wrong with image scaling?

Re: What causes images to be rendered dark?

Posted: 2012-05-01T18:21:27-07:00
by fmw42
The image is cmyk. IM probably does not resize well unless you convert the image first to rgb (preferably with profiles)

Re: What causes images to be rendered dark?

Posted: 2012-05-01T20:43:59-07:00
by anthony
More than likely the image is CMYK as Fred said.

But that does not explain the horizontal lines in the image.

I have only seen such lines when VERY low level type composition is used to recreate CMYK images using composition.
See http://www.imagemagick.org/Usage/bugs/testing/

This low level technique failed as CopyBlack composition does not understand grayscale images, only CMYK images, resulting in part of memory being copied instead! Though using the correct higher level operator -combine to do this does work properly.


More information on exact you are operating on the images is needed.

Re: What causes images to be rendered dark?

Posted: 2012-05-07T19:37:40-07:00
by hexmode
fmw42 wrote:The image is cmyk. IM probably does not resize well unless you convert the image first to rgb (preferably with profiles)
In the original bug report Tim suggests adding "-colorspace rgb". Would that help? Would it hurt images that are not cmyk?

Re: What causes images to be rendered dark?

Posted: 2012-05-07T19:55:50-07:00
by fmw42
hexmode wrote:
fmw42 wrote:The image is cmyk. IM probably does not resize well unless you convert the image first to rgb (preferably with profiles)
In the original bug report Tim suggests adding "-colorspace rgb". Would that help? Would it hurt images that are not cmyk?
If you are on a version of IM after 6.7.5.5 (possibly as late as 6.7.6.7) you need to use -colorspace sRGB, as after that sRGB and RGB were switched in -colorspace. However, the conversion to rgb would be best done using profiles, that is more accurate color conversion. Adding -colorspace sRGB/RGB should not matter if our image is already sRGB.

convert cykmimage.jpg -colorspace sRGB -resize ... rgbimage.jpg

or use profiles,

see
http://www.imagemagick.org/Usage/formats/#profiles

Re: What causes images to be rendered dark?

Posted: 2012-05-08T23:11:05-07:00
by anthony
With regards to CMYK. CMYK is ment to be a linear colorspace. As a result of the sRGB RGB this change CMYK will be correctly converted to linear colorspace when previously is was probably coming out with inverted sRGB values.

You can similulate what IM did previously with CMYK using (post change IM)

Code: Select all

   convert image -set colorspace RGB -colorspace CMYK .....
If your CMYK was produced with an old version of IM you can fix it to be correctly linear by using...

Code: Select all

  convert old_cmyk_image    -colorspace RGB -set colorspace sRGB -colorspace CMYK    new_cmyk_image