How did i resize a image to a fixed size?
Posted: 2008-01-15T05:13:32-07:00
I have tesed that Image::sample, Image::scale, Image::resize, Image::zoom will keep the ratio of a image's weight and height, is there a simple way to resize a image to a fixed size? for example, resize a image of 400×800 to 128*128.
In http://www.imagemagick.org/Usage/resize/#resize:
If you want you can 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.Unfortunately this character is also sometimes used by various UNIX and DOS command line shells. So you may have to escape the character somehow to preserve it.
convert dragon.gif -resize 64x64\! exact_dragon.gif
convert terminal.gif -resize 64x64\! exact_terminal.gif
how can I do this by using the C++ APIs?
thanks in advance
In http://www.imagemagick.org/Usage/resize/#resize:
If you want you can 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.Unfortunately this character is also sometimes used by various UNIX and DOS command line shells. So you may have to escape the character somehow to preserve it.
convert dragon.gif -resize 64x64\! exact_dragon.gif
convert terminal.gif -resize 64x64\! exact_terminal.gif
how can I do this by using the C++ APIs?
thanks in advance