I am running Debian and Ubuntu on my servers and I have found GraphicsMagick to be more stable for my needs than ImageMagick. The http://packages.ubuntu.com/graphicsmagick-imagemagick-compat allows imageapi to be used as is (by creating symlink as /usr/bin/convert). However, I need to have both GraphicsMagick and ImageMagick to be installed on the server, for other reasons. The native invocation of GraphicsMagick convert is

/usr/bin/gm convert

Add config option for argument(s) to prepend ("convert") along side the path to the binary ("/usr/bin/gm").

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cedarm’s picture

Version: 6.x-1.0 » 6.x-1.6

I think this request is still valid for the current version.

cedarm’s picture

FileSize
2.29 KB

Ok, here's a patch which adds two configuration options for imageapi_imagemagick. They both allow arbitrary options to be added to the command line (perhaps this should be protected by a separate permission?), but differ in their placement.

The first option, Prepend arguments, is explicitly for this issue, intended for GraphicsMagick support. Its value is placed immediate after the path to the binary, as the first argument.

The second option, Extra arguments, is placed after other $args in _imageapi_imagemagick_convert(). This can be used to add -strip or, as in the example, +profile '*', which will strip out ICC profiles. I was ending up with 3MB+ thumbnail images because of unnecessary data. Adding this brought it down to the usual size of ~1.2kB. I'll reroll the patch without this if desired.

cedarm’s picture

Status: Active » Needs review

(Grr, forgot status.) Needs review please.

drewish’s picture

Status: Needs review » Postponed

http://drupal.org/project/im_raw might be of interest for some of this because for the additional parameters you need the control over when they're used which in most imagecache scenarios means per-action. i'd say give that a look and see if it meets your needs.

cedarm’s picture

Great! That definitely gives more flexibility, per action. I'll rip out the "Extra arguments" option, but I still think "Prepend arguments" has a place for GraphicsMagick support. I wouldn't want to have to modify every preset just to change from IM to GM. Your thoughts?

drewish’s picture

Status: Postponed » Needs work

I guess i'm not clear what a GM command would look like. Something like:
/usr/bin/gm convert input.jpg output.jpg
And the convert bit tells GM to act like IM?

cedarm’s picture

Yes. The other way is to create a symlink to /usr/bin/gm named convert. (That's what the graphicsmagick-imagemagick-compat package contains, symlinks.)

BTW, it should be noted that GM doesn't (yet) support all of the options IM does, but seems to be sufficient for most needs.

cedarm’s picture

Status: Needs work » Needs review
FileSize
1.34 KB

Revised patch to only add "Prepend arguments" option, and not "Extra arguments".