H. Jang
H. Jang

Reputation: 348

Converting from YUV(UYVY) to RGB using imagemagick

I have YUV images. In windows7, yuvplayer can open them, as UYVY format.

And I want to convert one of those images to RGB, in Linux environment.

I think I can do conversion using imagemagick. But below errors occur.

1) without -depth 8

$ convert -verbose -size 736x480 yuv:frame-99.yuv frame-99.bmp
yuv:frame-99.yuv=>frame-99.yuv YUV 736x480 736x480+0+0 16-bit DirectClass 707KB 0.040u 0:00.050
yuv:frame-99.yuv=>frame-99.bmp YUV 736x480 736x480+0+0 16-bit DirectClass 1.057MB 0.360u 0:00.129
convert.im6: unexpected end-of-file `frame-99.yuv': No such file or directory @ error/yuv.c/ReadYUVImage/440.

2) with -depth 8

$ convert -verbose -size 736x480 -depth 8 yuv:frame-99.yuv frame-99.bmp
yuv:frame-99.yuv=>frame-99.yuv[0] YUV 736x480 736x480+0+0 8-bit DirectClass 707KB 0.060u 0:00.070
yuv:frame-99.yuv=>frame-99.yuv[1] YUV 736x480 736x480+0+0 8-bit DirectClass 707KB 0.020u 0:00.039
yuv:frame-99.yuv=>frame-99-0.bmp[0] YUV 736x480 736x480+0+0 8-bit DirectClass 1.057MB 0.670u 0:00.240
yuv:frame-99.yuv=>frame-99-1.bmp[1] YUV 736x480 736x480+0+0 8-bit DirectClass 1.057MB 0.870u 0:00.280
convert.im6: unexpected end-of-file `frame-99.yuv': No such file or directory @ error/yuv.c/ReadYUVImage/440.

Size of this file is 706560 bytes.

How can I convert a image?

Upvotes: 1

Views: 5349

Answers (2)

H. Jang
H. Jang

Reputation: 348

I tried using below command, as Mark Setchell said in comment.

convert -verbose -size 736x480 UYVY:frame-99.yuv frame-99.bmp

And I found this works well.

Upvotes: 2

AkselA
AkselA

Reputation: 8837

I believe the size you're specifying is too large. Imagemagick tries to fill the space with the data you supply, but encounters the EOF before it's done.
Make sure the -size parameter reflects the dimensions of the image you want to convert.

eg:

convert rose: UYVY:rose.uyv
convert -size 70x46 -depth 8 UYVY:rose.uyv -colorspace sRGB rose2.png

Upvotes: 0

Related Questions