How to use imageMagick to open a yuv image

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
michaels
Posts: 11
Joined: 2014-01-16T14:47:22-07:00
Authentication code: 6789

How to use imageMagick to open a yuv image

Post by michaels »

Hi,

I am running ImageMagick on ubuntu.
How can I use it to optn a yuv image?

I tried:
display ~/Downloads/tulips_yuv422_inter_planar_qcif.yuv
display: must specify image size `~/Downloads/tulips_yuv422_inter_planar_qcif.yuv' @ error/yuv.c/ReadYUVImage/145.
How can I find out the size of a yuv image? Can the tool detect it?

Thank you.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use imageMagick to open a yuv image

Post by fmw42 »

Sounds like you have a raw image in some yuv colorspace. With raw images, you need to know the image dimensions to be able to read it into IM, since there is no header with that information in the file. Then you will need to tell IM that the data is yuv, using -set colorspace YUV.

see
http://www.imagemagick.org/Usage/formats/#rgb
michaels
Posts: 11
Joined: 2014-01-16T14:47:22-07:00
Authentication code: 6789

Re: How to use imageMagick to open a yuv image

Post by michaels »

Thanks. I get the image "tulips_yuv422_inter_planar_qcif.yuv " from http://www.sunrayimage.com/examples.html.

I find out the image is All in qcif format, 176x144.

so I tried using IM by "display -size 176x144 -colorspace YUV tulips_yuv422_inter_planar_qcif.yuv "

It seems to me the 'red' part of the image is being duplicate by 4.
I don't know what the image supposed to look like so i am guess here.

I have been looking for a YUV 422 sample image, this is the only place I find from google.

If there is a better example, please let me know .

Thanks in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to use imageMagick to open a yuv image

Post by fmw42 »

YUV 4:2:2 is typically a video format. See http://www.fourcc.org/yuv.php

It is also from frame grabbers. See http://www.sensoray.com/support/appnote ... _modes.htm

For your specific image, you need to know its format structure from Sunrayimage. See http://www.sunrayimage.com/yuvformat.html

Tiff supports YUV 4:2:2, but is JPG compressed. You could likely write to that in IM from any input image.

See also any2yuv at http://any2yuv.sourceforge.net/Docs

ffmpeg can apparently read and write YUV. See http://www.ffmpeg.org/general.html#Image-Formats

I have really no experience with reading or writing to YUV. Perhaps one of the other IM users can help further.
Post Reply