开发者

how to crop image in web based python application?

I'm searching for a way to crop image on a web based python application such as appengine application , can i do that ?? if开发者_JAVA百科 yes which lib i have to use ??


Google App Engine does not allow one to upload binary modules along with the Python Libraries - just pure Python modules are allowed.

But Google App Engine has its own API, among which an Image API taht has a crop function: http://code.google.com/appengine/docs/python/images/functions.html

If you need any extra functionality Python developers ansd usrs alike know well of speed issues with Python when you come down to raw data processing - like pixel processing: the idea with Python is simply leave the pixel manipualtion per se for binary code accessible through a wrapper.

Therefore, there is a stalemate there. The most a "pure python image module" search yields is a library to parse JPEG files. It would not be hard to assemble a small library that could deal with a limited numebr of formats for a few basic operations, though it would be slow.

(MAybe it is possible to use Corepy (http://www.corepy.org/) to dinamically create binary code inside GAE - but I doubt so. It wouldb e an interesting experiment though- although it is pure Python, chances are there are sandboxing barriers in place to prevent Corepy from working)

Another alternative is to set-up an image processing API yourself, using one of various Python binary modules for manipluating images likePython Sig, PIL, PyGegl, Pyleptonica, PythonMagick on another server, and use jsonrpc from GAE to process the images remotely.


In Google Appengine you have google.appengine.api.images.crop which does that for you.

If you are using another service, you need to use PIL.Image.crop

(The crop functions are a bit down on the pages, look them up with search)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜