Page 1 of 1
switching colorspaces RGB -> YCbCr
Posted: 2009-03-16T05:10:54-07:00
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
Re: switching colorspaces RGB -> YCbCr
Posted: 2009-05-14T05:31:04-07:00
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
Re: switching colorspaces RGB -> YCbCr
Posted: 2009-05-18T05:41:40-07:00
by magick
Good catch. We patched ImageMagick 6.5.2-6 Beta to fix the problem you reported. Thanks.
Re: switching colorspaces RGB -> YCbCr
Posted: 2009-05-19T01:44:34-07:00
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
Re: switching colorspaces RGB -> YCbCr
Posted: 2009-05-19T06:02:23-07:00
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.
Re: switching colorspaces RGB -> YCbCr
Posted: 2010-08-31T01:57:03-07:00
by cs_rol
Did something come up on the investigation?