Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does anyone know how to use this when resizing images with PHP's 'imagick' library? Currently I use:

    $im->resizeImage($box_x, $box_y, Imagick::FILTER_LANCZOS, 1, 1);

or...

    $im->resizeImage($box_x, $box_y, Imagick::FILTER_CATROM, 1, 1);
On the man page there is no obvious way to use the imagick::INTERPOLATE_SPLINE constant when resizing images:

http://php.net/manual/en/imagick.resizeimage.php

It is a shame that such small tweaks is always a non-existent man-page away with PHP's ImageMagick wrapper. (Using spline could smooth out a lot of straight and thin edges, but, as it is, I will never find out.)



For resizing operation you use a resampling filter, not an interpolation method. E.g. the 'point' filter corresponds to the 'nearest' interpolation. http://www.imagemagick.org/Usage/filter/

To set interpolation for e.g. rotation operations, you'd use the setImageInterpolateMethod method:

http://php.net/manual/en/imagick.setimageinterpolatemethod.p...


Not at a computer I can test at the moment, but perhaps Imagick::FILTER_SPLINE ?

https://github.com/mkoppanen/imagick/blob/3.3.0/imagick_help...


'spline' interpolation is really just gussian-like blurring of the image (using a sigma of 0.65).

Could you just use a gaussian blur instead?




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: