Page 1 of 1

specifying algorithms for Image::scale()/sample()

Posted: 2012-03-31T09:27:21-07:00
by whatdoido
Hello

is it possible with the Magick++ i/f to specify the scale/resize algorithm? The API only provides ::scale() and ::sample()

Re: specifying algorithms for Image::scale()/sample()

Posted: 2012-03-31T09:45:55-07:00
by fmw42
I am not an API user, but there should be the equivalent resize() with filter option to the command line -filter xx -resize.

see
http://www.imagemagick.org/Usage/resize/

Re: specifying algorithms for Image::scale()/sample()

Posted: 2012-04-01T23:23:14-07:00
by anthony
scale and sample are simply faster varients of specific filters in the resize() operation.

Re: specifying algorithms for Image::scale()/sample()

Posted: 2012-04-04T06:01:23-07:00
by whatdoido
Thanks.

After the mention of "filters" I revisited the Image documentation and found

Code: Select all

Image::filterType(...)
[/b] and states:
"Filter to use when resizing image. The reduction filter employed has a sigificant effect on the time required to resize an image and the resulting quality. The default filter is Lanczos which has been shown to produce high quality results when reducing most images."
I am scaling down/resizing photos (portraits) from >4k on longest edge to 1024 or smaller. Using the scale/sample methods the output image makes the people in the images look to have "jaggered" edges.

Will use Image::resize() as suggested and specifying the filter as appropriate as my current usage of scale/sample seems to use no advance filter at all - the documentation:

sample() - Resize image by using pixel sampling algorithm
scale() - Resize image by using simple ratio algorithm


Thanks all.

Re: specifying algorithms for Image::scale()/sample()

Posted: 2012-04-05T01:32:42-07:00
by anthony
As I mentioned sample() and scale() are fast non filtered versions of resize()

The documentation does not seem to mention resize() but I am sure it must be their somewhere!
Perhaps under the old (IMv4) terminology of transform()????

This was a function that either resizes or cropped the image based on a string. It is old.