I’ve got the following code which uses Imagemagick to resize PNG images.
$im = new imagick("$file");
$im->thumbnailImage($newwidth, $newheight);
$im->writeImage($output);
However this produces images which, as far as I know, are made as small as Imagemagick can make them while using the thumbnailimage() method.
Ideally I want to resize the image and keep the quality of the output image as high as possible, file size isn’t really an issue for me in this case. Is there an alternative method that will allow me to resize a PNG and keep the quality as high as possible?
It’s a given that scaling down an image will reduce its quality. However, you can simulate that quality with interpolation.
PHP’s GD extension does come with an
imagecopyresampledfunction, however it’s not the best quality. However, in the [comments] I did find a usefulimagecopyresampledbicubicfunction that should be of a much better quality than the native one. Certainly seems worth a try.