imagecow
imagecow copied to clipboard
(Imagick) Suggestion to allow setting filter type and blur for better resize quality.
Hi,
Just a suggestion for the Imagick implementation in imagecow. Specifically, in Libs/Imagick.php, on line 229 where it uses scaleImage():
if ($this->image->scaleImage($width, $height) !== true) {
https://www.php.net/manual/en/imagick.scaleimage.php
ScaleImage() does not allow configuration of the filter or blur setting. The function resizeImage() is very similar but allows for changing these settings. https://www.php.net/manual/en/imagick.resizeimage.php
For example we set the filter to Lanczos, and blur to 0.8:
if ($this->image->resizeImage($width, $height, \Imagick::FILTER_LANCZOS, 0.8) !== true) {
This vastly improved the quality of resized images. Especially ones with text on them.
Hi, thanks for the suggestion, I really like it! Do you want to work on a pull request? (If you don't want, don't worry, I can do it)
I'll let you do it. :)