Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3809242
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:16:30+00:00 2026-05-19T15:16:30+00:00

Given is the follwing model on GAE: avatar = db.BlobProperty() By calling the image

  • 0

Given is the follwing model on GAE:

avatar = db.BlobProperty()

By calling the image instance properties height or width (see documentation) with:

height = profile.avatar.height

the following error is thrown:

AttributeError: ‘Blob’ object has no attribute ‘height’

PIL is installed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:16:31+00:00Added an answer on May 19, 2026 at 3:16 pm

    If the image is stored in a BlobProperty, then the data is stored in the datastore, and if profile is your entity, then the height can be accessed as:

    from google.appengine.api import images
    height = images.Image(image_data=profile.avatar).height
    

    If the image is in the blobstore, (blobstore.BlobReferenceProperty in the datastore), then you have 2 ways of doing it, the better way is complicated and requires getting a reader for the blob and feeding it to a exif reader to get the size. An easier way is:

    if avatar = db.BlobReferenceProperty() and profile is your entity, then:

    from google.appengine.api import images
    img = images.Image(blob_key=str(profile.avatar.key()))
    
    # we must execute a transform to access the width/height
    img.im_feeling_lucky() # do a transform, otherwise GAE complains.
    
    # set quality to 1 so the result will fit in 1MB if the image is huge
    img.execute_transforms(output_encoding=images.JPEG,quality=1)
    
    # now you can access img.height and img.width
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given is on gae using tipfy (python) the following model: greeting.avatar = db.Blob(avatar) What
Given the following example model (which reflect my Entity Framework entities, properties omitted for
Given following snippet in a view: <style type=text/css> input[type=text] { width: <%: Model.CmsConfiguration.cms_form_width %>px;
Given the following model, I want to index the fields (sequence,stock) class QuoteModel(models.Model): quotedate
Given the following model: class Project(models.Model): project_name = models.CharField(max_length=255) abstract = models.TextField(blank=True, null=True) full_description
This is just an example, but given the following model: class Foo(models.model): bar =
Given the following Contribution model: class Contribution(models.Model): start_time = models.DateTimeField() end_time = models.DateTimeField(null=True) is
Given the following models: class Post(models.Model): title = models.CharField(max_length=200) html = models.TextField() class PostTag(models.Model):
Given the following JSON data: [ { pk: 2, model: corkboard.announcement, fields: { body:
Given the following view : def comments(request): comments_list = Thing.objects.filter(thing_type=2) #Thing model extends MPTTModel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.