GAE images.resize with fixed proportional crop

Posted by user288541 on Stack Overflow See other posts from Stack Overflow or by user288541
Published on 2010-03-08T06:45:38Z Indexed on 2010/03/08 6:51 UTC
Read the original article Hit count: 340

I need to resize and crop to exactly 60x80px from various size and aspect ratio. Just before i put into Datastore. Anyone already got this issue resolved.

Currently i already succed to just transform it to exact height (80px) with various width which nott look so good when i try to display it on a list. e.g jcaroussel.

My db.put code is like bellow:

    if users.get_current_user():
        personal.personal_id = int(self.request.get('personal_id'))
        personal.name = self.request.get('name')
        personal.latitude = self.request.get('latitude')
        personal.info = self.request.get('info')
        photo = images.resize(self.request.get('img'), 0, 80)
        personal.photo = db.Blob(photo)
        personal.lc_id = int(self.request.get('lc_id'))
        personal.put()
        self.redirect('/admin/personal')

    else:
      self.response.out.write('I\'m sorry, you don\'t have permission to add this LP Personal Data.')

I just want to do similar result when we upload our avatar on google talk/google chat.

Anyone solved this?

Thx

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about images