How to convert a AYUV image to an RGB one?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
colorspace
Posts: 1
Joined: 2012-03-01T06:53:16-07:00
Authentication code: 8675308

How to convert a AYUV image to an RGB one?

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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/
Post Reply