Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Google App Engine

You're reading from   Mastering Google App Engine Build robust and highly scalable web applications with Google App Engine

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781784396671
Length 368 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Images


Just because it is useful to some extent, we are going to talk about the image processing capabilities that are available to you on Google App Engine. They might not be as sophisticated as you'd expect from other image processing libraries in other languages, but they are still good enough for most common cases in web applications.

The entire functionality resides in the google.appengine.api.images module. The main class here is Image, which can be initialized with raw binary data like this:

image = Image(image_data=data)
where data can be from a file or from request like this:
class ImageResize(webapp2.RequestHandler):
    def post(self):
        # photo is an <input type='file'> from HTML request
        photo = self.request.params.get('photo')
        # photo is FieldStorage class which has file attribute which is like a file object.
        image = images.Image(image_data=photo.file.read())

The Image class can also be initialized from Blobstore if you have a blob key as a string...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime