Mostly Grails tips from Code Panda

Manipulating images on the Google App Engine with Gaelyk

If you are building a grails application, you can use either imageMagick or the imageTools plugin to resize and crop your images. This is not possible in the Google App Engine because it neither allows you install external packages nor whitelists JAI components.

Fortunately, we can use the Java-based image resizing API provided in the App Engine for simple manipulation.

I’ve written about how to write this in Grails, but since the latest update to the App Engine seems to break all my Grails applications ( which is pretty stupid ), I wanted to try to do this in Gaelyk – the lightweight groovy-based framework for the app engine.

you will need to copy the Apache FileUtil libs to your template’s lib directory to get this to work. See Mr. Haki’s blog post for more details.

The imageService to image binding by Gaelyk seems pretty useless, since most of the work is actually done by the Factory. Would be nice if the images shortcut provided by Gaelyk mapped to both the service and the Factory.

The imageService is very limited. You can do image compositions ( adding one image to another ), crop, rotate in 90 degree angles and flips. For anything more complicated, you should look into integrating an external image service such as Picnik.

You can use the blobstore as the image storage engine. Documentation is here.

9 thoughts on “Manipulating images on the Google App Engine with Gaelyk”

Good point about the useless image service itself.
When I first added that service in the mix, I noticed that lots of useful utility methods were in the factory itself which sounded a bit silly.
But actually, your suggestion of trying to have the shortcut map to both the factory and the service itself is something I could look into.
Thanks for the suggestion.

I’m using the images service these days for a small family app (sharing pictures), and I came across that weirdness of factory vs service sharing different set of methods.
I’m going to fix this in the next version of Gaelyk by combining both classes in a same wrapper.