Support for YUV420P?

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
User avatar
jonoomph
Posts: 27
Joined: 2011-03-27T14:25:09-07:00
Authentication code: 8675308

Support for YUV420P?

Post by jonoomph »

Greetings! I was wondering if ImageMagick++ has an easy way to convert RGB pixels into YUV420P (planar) values? I need to set the pixel data on a SDL_Overlay, which requires me to convert my Magick::Image pixel data into the YUV420P format. Can ImageMagick++ help me with this conversion? Or should I write my own conversion code?

I did find the Magick::ColorYUV class, but it doesn't seem to support the 4:2:0 planar format... unless I am misunderstanding how it works. Any thoughts would be much appreciated.

Thanks!
-Jonathan
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Support for YUV420P?

Post by magick »

Try
  • im.interlaceType(PlaneInterlace);
User avatar
jonoomph
Posts: 27
Joined: 2011-03-27T14:25:09-07:00
Authentication code: 8675308

Re: Support for YUV420P?

Post by jonoomph »

Thanks for the reply. So, if I call the interlaceType(PlaneInterlace) method, I assume it will tell the Image to store the Y,U, and V in separate planes? I am no expert on YUV420P, but it looks like I'm supposed to have more Y values, and less U & V values. Every pixel would have a corresponding Y value... and the U and V values would represent a 2x2 pixel block. So, there are 1/4 less U and V values.

So, once I invoke that method, what would be the best approach to access these YUV values? Would I still use the Magick::ColorYUV class?

Thanks again for your help!
-Jonathan
Post Reply