I converted a image with the below ImageMagick command line option.
$convert input_image.jpg -sampling-factor 4:2:0 output_image.jpg
I used ImageMagick/bin/convert and Now, I want to implement it with Magick++.
I have a Magick::Image instance which read the pixel values with .read() method.
I'd like to do chromatic downsampling in YUV format
and want to save this instance to the file, as I did in the above command line options.
I cannot find any method to convert Magick::Image to YUV4:2:0 format.
Can you help me?
Then I will save this Magick::Image instance as Jpeg, 75 quality.
Thanks
How to convert Magick::Image to YUV 4:2:0 format?
Re: How to convert Magick::Image to YUV 4:2:0 format?
You can do the following:
Code: Select all
image.defineValue("jpeg", "sampling-factor", "4:2:0");
Re: How to convert Magick::Image to YUV 4:2:0 format?
dlemstra, thank you very much.
It works well.
It works well.
Re: How to convert Magick::Image to YUV 4:2:0 format?
If I save like the below codes with the default parameter.
Magick::Image image;
image.read(src_width, src_height, "RGB", Magick::CharPixel, (char *) pPixelData );
image.write("/home/myid/output.jpg");
If I just save image without any change.
what is the default for chroma option?
4:4:4? or 4:2:0?
Magick::Image image;
image.read(src_width, src_height, "RGB", Magick::CharPixel, (char *) pPixelData );
image.write("/home/myid/output.jpg");
If I just save image without any change.
what is the default for chroma option?
4:4:4? or 4:2:0?
Re: How to convert Magick::Image to YUV 4:2:0 format?
4:2:0 seems to be the default.