Page 1 of 1

Magick++ Resize Image

Posted: 2011-02-04T18:14:13-07:00
by Morty
Hi there,

I hope someone can help me.

I am using the Magick++ API and want to resize a 1920x1080 image to 720x480. I can do this with the command line no problem, but can't find a way to achieve this with Magick++. My images keep coming out as 720 x 405.

I have tried :

Geometry newSize = Geometry(720, 480);
background.resize(newSize);

Geometry newSize = Geometry(720, 480);
background.zoom(newSize);

Thanks for your time,

Jim

Re: Magick++ Resize Image

Posted: 2011-02-04T19:48:54-07:00
by magick
The image aspect ratio is respected by default for image geometries. You can override this behavior, like this:
  • Geometry newSize = Geometry("720x480!");

Re: Magick++ Resize Image

Posted: 2011-02-05T02:23:24-07:00
by Morty
Thanks,

It's so obvious, now. Your help is much appreciated.

All the best,

Jim

Re: Magick++ Resize Image

Posted: 2011-02-05T03:57:31-07:00
by Morty
I found the following works as well:

Code: Select all

Geometry newSize = Geometry(720, 480);
// Resize without preserving Aspect Ratio
newSize.aspect(true);
background.resize(newSize);
Hope this helps someone else.