Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)

So, Google App Engine doesn't look like it's going to include the Python Imaging Library anytime soon. There is an images api, but it's paltry, and inadequate for what I need.

I'm wondering what Python only (no C-extensions) there are that can replace the Image.paste and the ImageDraw modules. I don't want to write them myself, but that is an option. I'm also open to other solutions, such as "do the processing somewhere else, then call via api", if they're not too ugly. (For the record, the solution I just suggested seems pretty ugly to me.)

How have others gotten around this?

(I'm not wedded to GAE, just exploring, and this looks like a deal breaker for my app.)

Notes:

For me, crop, resize is not enough. In particular I need

  1. paste (replace part of an image with another.... can be faked with "compose")
  2. draw (for drawing gridlines, etc. Can be faked as well)
  3. text (write text on an image, much harder to fake, unless someone wants to correct me)
like image 590
Gregg Lind Avatar asked Jul 15 '09 15:07

Gregg Lind


2 Answers

My skimpygimpy.sourceforge.net will do drawing and text, but it won't edit existing images (but it could be modified for that, of course, if you want to dive in). It is pure python. see it working on google apps, for example at http://piopio.appspot.com/W1200_1400.stdMiddleware#Header51,

That's an experimental site that I'll be messing with. The link may not work forever.

like image 120
Aaron Watters Avatar answered Nov 09 '22 23:11

Aaron Watters


Your assumption is wrong. If you use the Python 2.7 runtime, you can use PIL (version 1.1.7) as documented here: https://developers.google.com/appengine/docs/python/tools/libraries27. This article also explains how to enable PIL for your app.

BTW, the last comment in the bug you referenced also mentions it.

like image 35
schuppe Avatar answered Nov 09 '22 22:11

schuppe