switching colorspaces RGB -> YCbCr

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
cs_rol
Posts: 22
Joined: 2007-01-16T04:40:08-07:00

switching colorspaces RGB -> YCbCr

Post by cs_rol »

Hello!

When i try to convert a file to YCbCr its still RGB in the end (at least identify suggest it so)

Code: Select all

identify -verbose in.jpg
convert in.jpg -colorspace ycbcr out.jpg
identify -verbose out.jpg
Is this a bug or are RGB and YCbCr indistinguishable?

Thanks for comments.
regards,
richard
cs_rol
Posts: 22
Joined: 2007-01-16T04:40:08-07:00

Re: switching colorspaces RGB -> YCbCr

Post by cs_rol »

hi, i had a look at the sourcecode. I found a wrong statement in jpeg.c ReadJPEGImage

Code: Select all

1020	  if (jpeg_info.out_color_space == YCbCrColorspace)
1021	    image->colorspace=YCbCrColorspace;
since YCbCrColorSpace is a ImageMagick type and jpeg_info.out_color_space is a libjpeg type this I think this comparison should rather be:

Code: Select all

if (jpeg_info.out_color_space == JCS_YCbCr)
maybe this post should be moved to the Bugs Forum
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: switching colorspaces RGB -> YCbCr

Post by magick »

Good catch. We patched ImageMagick 6.5.2-6 Beta to fix the problem you reported. Thanks.
cs_rol
Posts: 22
Joined: 2007-01-16T04:40:08-07:00

Re: switching colorspaces RGB -> YCbCr

Post by cs_rol »

I tried out the new version, but this still doesn't work. (see my introductory posting)

this is due to the libjpeg which sets jpeg_color_space to JSC_YCbCr and out_color_space to JSC_RGB
jdapimin.c:
/* Guess the input colorspace, and set output colorspace accordingly. */
/* (Wish JPEG committee had provided a real way to specify this...) */
/* Note application may override our guesses. */
/* Always guess RGB is proper output colorspace. */
and imagemagick always uses out_color_space. Is there a posibility to get the other value (the actual colorspace)

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

Re: switching colorspaces RGB -> YCbCr

Post by magick »

If the original colorspace is available from the JPEG API we certainly could provide it. However, if the API returns RGB instead there is not much we can do. We'll investigate the problem further sometime this week.
cs_rol
Posts: 22
Joined: 2007-01-16T04:40:08-07:00

Re: switching colorspaces RGB -> YCbCr

Post by cs_rol »

Did something come up on the investigation?
Post Reply