Page 1 of 1

How to resize/resample image using MagickCore

Posted: 2009-02-06T14:14:54-07:00
by wchang615
Hi,

I want to use the MagickCore to do the exact the same as the command-line "Convert -resize 64x64 input.jpg output.jpg" which wil scale the image accordingly rather than fix the dimensions as in ResizeImage, SacleImage, etc. for given the column and row size.

When using command-line "Convert" for a given image with geometry of 2492x1944+0+0, after resize with 64x64, it produced geometry with 64x48.

How would I do that?

Thanks for any help.

Best,

--Wo

Re: How to resize/resample image using MagickCore

Posted: 2009-02-06T15:15:19-07:00
by magick
Use TransformImage() if you want the aspect ratio of the image to be respected. ResizeImage(), as you have seen, resizes to the exact image dimensions you provide.

Re: How to resize/resample image using MagickCore

Posted: 2009-02-08T18:31:51-07:00
by wchang615
Great and thanks, it works!
BTW: I also see the TransformImages, how does this work?
By looking at the parameters:
MagickBooleanType TransformImages(Image **image,
const char *crop_geometry,const char *image_geometry)

how do you provide a list of images? Are there any advantages of using TransformImages vs. TransformImage? If it does cut down the processing time, I'd be very interested since I have over 5,000+ pictures to process.

Thanks again for any answer.

--Wo

Re: How to resize/resample image using MagickCore

Posted: 2009-02-09T07:18:14-07:00
by magick
Use TransformImages() if you want to resize a list of images. A GIF image may have 10 frames, for example, and TransformImages() will resize (or crop) all 10 frames in the sequence.

Re: How to resize/resample image using MagickCore

Posted: 2009-02-09T08:01:11-07:00
by wchang615
Good feature! Thanks for the info.

--Wo