简体   繁体   中英

Default filter type for resize in magick++ api

I am trying to resize images using Magick++ api in C++. I have used the following code and it is working good.

Image second = image;
Geometry newSize = Geometry(69,69);
// Resize without preserving Aspect Ratio
newSize.aspect(true);
second.resize(newSize);

The result is good but I need to know the default filter type it is using as I am not giving any other argument in resize() function. I have searched in documentation but could not find much. Thank you for the help.

In MagickCore libary, the ReszieImage method does default to LanczosFilter .

From MagickCore/resize.c

 filter_type=LanczosFilter; if (filter != UndefinedFilter) filter_type=filter; 

However in Magick++ the default filterType is UndefinedFilter . Take the following..

Magick::Image image("rose:");
std::cout << image.filterType() << std::endl;
//=> 0

IMHO, always define the filter with Magick::image::filterType( const Magick::FilterTypes filterType_ ) . It'll help when your reading the code in the future.

I have got the answer to my own question. It was Lanczos resampling . A very good magick++ documentation can be found here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM