1

Is it possible to convert png image using Image Magick into raw NV21 or NV12 formart ?

I do the following:

convert test_color.png -size 1024x768 -depth 8 -colorspace Rec601YCbCr yuv:image.bin

The converted image is YV12 according to the rawpixels.net

I want to convert the picture into NV21 for the reference to test my converters.

Thanks!

Rotem
  • 30,366
  • 4
  • 32
  • 65
Bill Lumbert
  • 4,633
  • 3
  • 20
  • 30
  • You don't need `-size 1024x768` in that command, it is unnecessary as the output image will be the size of the input image (`test_color.png`) which is encoded in that file. – Mark Setchell Jun 10 '19 at 18:43
  • Could you be more specific about the NV21 format you want, i.e. describe it accurately and completely or give a link to a very clear description of what you need. – Mark Setchell Jun 10 '19 at 18:45
  • What is `rawpixels.net` which you refer to please? – Mark Setchell Jun 10 '19 at 18:48
  • I am using `ffmpeg` to do that. What are the benefits of `ImageMagick`? – Rotem Jun 10 '19 at 20:28
  • @Rotem If you have a good `ffmpeg` solution please add it as an answer so folks are aware of it and can vote for it. We are all here to share and learn. – Mark Setchell Jun 10 '19 at 22:23
  • 2
    Example for converting `png` to `nv12` Rec. 601: `ffmpeg -y -colorspace bt470bg -i 1.png -pix_fmt nv12 1.yuv` – Rotem Jun 10 '19 at 22:48
  • @MarkSetchell I can't give an answer using `ffmpeg`, because the question is about `ImageMagick`. – Rotem Jun 10 '19 at 22:49
  • I don't see it that strictly! If an answer is relevant, useful and works I think it is fine to post it. It could be that OP and/or others were unaware that a different tool could do the job. If OP or others doesn't want to, or can't, use a different tool, they can just ignore it. No harm done. Obviously don't post answers to every single question on Stack Overflow in assembly language, or BASIC.... but you know what I mean. – Mark Setchell Jun 10 '19 at 23:00

0 Answers0