specify filter for thumbnailImage()

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
newtron
Posts: 3
Joined: 2015-03-11T17:57:39-07:00
Authentication code: 6789

specify filter for thumbnailImage()

Post 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!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: specify filter for thumbnailImage()

Post 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?
newtron
Posts: 3
Joined: 2015-03-11T17:57:39-07:00
Authentication code: 6789

Re: specify filter for thumbnailImage()

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: specify filter for thumbnailImage()

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: specify filter for thumbnailImage()

Post 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.
Post Reply