Resize without preserving aspect ratio in Magick++

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Bob-O-Rama
Posts: 31
Joined: 2007-11-23T15:34:51-07:00

Resize without preserving aspect ratio in Magick++

Post by Bob-O-Rama »

Hi,

I've tried Image::sample() and Image::resize() images to a smaller size by specifying geometries like "1440x720!" or just "1440x720" ) and I very often get a pixel or two shaved off the resulting height or width ( but never both ) of the resulting image. What is the proper way to do this?

As always, thanks!

-- Bob
Bob-O-Rama
Posts: 31
Joined: 2007-11-23T15:34:51-07:00

Re: Resize without preserving aspect ratio in Magick++

Post by Bob-O-Rama »

The issue, as it turns out, is that creating a Geometry object using "800x600!" e.g.

Code: Select all

Geometry output = "800x600!";
does not set the aspect flag in the object. To get it to work I needed to use

Code: Select all

output.aspect( TRUE );
to get subsequent Image::resize( output ) to work as I needed. Isn't the exclam supposed to do this, or is this working as designed?

-- Bob
Post Reply