Zeynel
Zeynel

Reputation: 13525

How to use Image.ANTIALIAS with resize() in GAE?

I am using the script below to resize images. But I noticed that the resized image looses sharpness. According to this page Image.ANTIALIAS is the best "downsizing filter". But when I add the filter to the code

images.resize(homepage.original_image, 200, 200, Image.ANTIALIAS)

I get

AttributeError: type object 'Image' has no attribute 'ANTIALIAS'

Is there a way around this? Thanks

class ImageResize(webapp.RequestHandler):
    def get(self):
        q = HomePage.all()
        result = q.fetch(3)
        for item in result:
            firm = item.firm_name
            id = item.key().id()
            if id:
                homepage = HomePage.get_by_id(id)
                if homepage:
                    thumbnail =    images.resize(homepage.original_image, 200, 200)
                    homepage.thumbnail = db.Blob(thumbnail)
                    homepage.put()

Upvotes: 0

Views: 2145

Answers (1)

Mark Ransom
Mark Ransom

Reputation: 308520

The documentation you linked is for PIL but you're using the Google App Engine images API, the documentation for which is here: http://code.google.com/appengine/docs/python/images/functions.html

Upvotes: 3

Related Questions