How to force resize the images thru API?

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
puncha

How to force resize the images thru API?

Post by puncha »

How to use the APIs to force "-resize" to ignore the aspect ratio and distort the image so it always generates an image exactly the size specified.

This is done by adding the character '!' to the size through the command lines. But how to achieve this through API?

CLI:
convert dragon.gif -resize 64x64! exact_dragon.gif
convert terminal.gif -resize 64x64! exact_terminal.gif
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to force resize the images thru API?

Post by magick »

The API resizes the image to the exact dimensions you give. For example, ResizeImage(image,108,97,...) returns an image that is 108x97 pixels regardless of the aspect ratio of the original image.
puncha

Re: How to force resize the images thru API?

Post by puncha »

magick wrote:The API resizes the image to the exact dimensions you give. For example, ResizeImage(image,108,97,...) returns an image that is 108x97 pixels regardless of the aspect ratio of the original image.
Thanks, it works. By the way, does Magick++ expose a force resize function? I don't think Image::resize() provide a force resize.
Post Reply