Page 1 of 1

How to convert a AYUV image to an RGB one?

Posted: 2012-03-01T10:24:39-07:00
by colorspace
I have a 4:4:4 four component AYUV image (8-bit precision per component) in YCbCr space. I am trying to convert it to any other non-lossy image format in RGB space. No matter what I try, the colors in the output image look wrong as if they are in the wrong space. Anybody have any hints on what command line parameters I need to pass to "convert"?

This is what I thought I should use:

convert -size 640x480 -colorspace YcbCr -sampling-factor 4:4:4 input.yuv output.png

Does -colorspace set the color space of the output image or does it define the color space of the input image? I think this could be the problem since I am basically trying to convert both the image format and the color space at the same time.

Thanks!

Re: How to convert a AYUV image to an RGB one?

Posted: 2012-03-01T15:12:24-07:00
by fmw42
I am not an expert on image formats, but ...

For vector formats such as pdf, etc -colorspace is used before reading the input image to specify the colorspace of the image as it is read in. But for bit-mapped (pixel) images, you specify the -colorspace after reading the input to convert the output to that colorspace.

I am not sure what your yuv image is (or whether IM can read AYUV images in that channel order), but I would try reading it right after the convert and then put your other arguments before the output image.

see
http://www.imagemagick.org/Usage/basics/#cmdline
http://www.imagemagick.org/Usage/color_basics/