Page 1 of 1

specify filter for thumbnailImage()

Posted: 2015-04-07T06:28:18-07:00
by newtron
Would it be possible to add support to set a filter for use with thumbnailImage() in the API, similar to how a filter can be set with resizeImage()? I'm trying to do this via Imagick in PHP and have hit a wall. I posted an issue about it with Imagick and was directed here.

So basically I'd like to be able to do the equivalent of:

Code: Select all

convert -filter Triangle -thumbnail 300 input.png output.png
Thanks!

Re: specify filter for thumbnailImage()

Posted: 2015-04-07T07:32:55-07:00
by Bonzo
Imagick is not written or supported by the people from Imagemagick.

Out of interest why not use resizeImage() if it does what you want?

Re: specify filter for thumbnailImage()

Posted: 2015-04-07T07:38:29-07:00
by newtron
The issue isn't with Imagick; the Imagick team said that the issue was with the ImageMagick API, and that it didn't offer filter setting for thumbnail in this manner. There was nothing for Imagick to hook into.

resizeImage() doesn't work exactly the same as thumbnailImage() — thumbnailImage() sometimes calls sampleImage() before resizeImage(), and also strips some data after resizing. I could recreate this in my PHP code, but it would be cleaner if the API allowed some way for Imagick to to set this directly.

Re: specify filter for thumbnailImage()

Posted: 2015-04-07T08:21:23-07:00
by fmw42
If Imagemagick were to make a change to make this available, I would think you would still have to have the Imagick people make a change to their code. I am not aware that they are very responsive to keeping Imagick up to date with Imagemagick.

You can basically reproduce -thumbnail with -strip -resize and that would then allow you to include -filter ( which would likely override any sampleImage control ), but I will defer to the IM developers.

Re: specify filter for thumbnailImage()

Posted: 2015-04-07T08:35:15-07:00
by Bonzo
I am a bit confused, can you build Imagick against any version of Imagemagick? I have checked the PECL and php Imagick pages and they both say:
PHP >= 5.1.3 and ImageMagick >= 6.2.4 is required. The amount of formats supported is by Imagick is entirely dependent upon the amount of formats supported by your ImageMagick installation. For example, Imagemagick requires ghostscript to conduct PDF operations.