Imagemagick ItemEditOption module ideas.

vectro

Joined: 2008-07-03
Posts: 15
Posted: Thu, 2008-07-03 04:16

All,

I want to create a module that will allow users to enter an imagemagick command line and have the image modified accordingly. For example, if the image was not properly horizontally aligned, one might specify "-rotate 3 -crop 700x500+50+50".

I was planning on approaching this by creating a new kind of transform, call it the "imagemagickcommand" transform. So there would be a new class ImageMagickEditOption (subclass of ItemEditOption) that recieves the parameters and adds the command line to the transform stack. And then there would have to be a new GalleryToolkit to process the new transform. The existing ImageMagickToolkit is highly integrated, so it wouldn't be possible to subclass it. Instead I'd probably just create a new ImageMagickCommandToolkit that only knows how to handle the "imagemagickcommand" transform type.

Questions for the gallery community before I get knee-deep in the code:

1. Any commentary on the above?

2. What should the relationship, if any, be between this code and the existing imagemagick module? It could be none, as proposed above. But other options would be to include this new code as part of the ImageMagick module, or else to modify the ImageMagick module just enough that it could be subclassed for the new imagemagickcommand module. What do you think is the best approach?

3. Is it worthwhile to try and collapse existing transforms into one command? The ImageMagickCommandToolkit could override mergeOperations to grab any crop or rotate options and stick them on the same command line. Collapsing a command line itself strikes me as a tricky and error-prone business.

Thanks in advance for your kind advice.