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

  • SEARCH
  • Home
  • 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 8963853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:27:03+00:00 2026-06-15T16:27:03+00:00

Using Python Image Library PIL and Google App Engine Blobstore… This: img = images.Image(blob_key=image)

  • 0

Using Python Image Library PIL and Google App Engine Blobstore…

This:

img = images.Image(blob_key=image)
logging.info(img.size)
self.response.headers['Content-Type'] = 'image/jpeg'
self.response.out.write(img)

Has Attribute error:

AttributeError: 'Image' object has no attribute 'size'

So the Image instance from google app engine does not have size?

So then how does this work:

img = images.Image(blob_key=image)
img.resize(width, height)
img.im_feeling_lucky()
thumbnail = img.execute_transforms(output_encoding=images.JPEG)
self.response.headers['Content-Type'] = 'image/jpeg'
self.response.out.write(thumbnail)

What am I missing?

EDIT:

The fix was using the get_serving_url and not use my image server as proposed by @voscausa.
Due to the fact that my object was parsed by jinja2 templating it was impossible to create a Image object via jinja2.
So the final solution worked as below:

class Mandelbrot(db.Model):
  image = blobstore.BlobReferenceProperty()

@property
def image_url(self):
  return images.get_serving_url(self.image)

This way I could parse the image url to my page like:

<img src=
{% if mandelbrot.image %}
  "{{ mandelbrot.image_url }}" 
{% else %} 
  "./assets/img/preloader.gif"
{% endif %}
/>
  • 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-06-15T16:27:04+00:00Added an answer on June 15, 2026 at 4:27 pm

    I’am not familiair with PIL, because I use another solution from Google for serving and sizing images.
    Google can serve the images for you, using Google High Performance Image serving. This means:

    • you have to create once, a serving_url for images in the blobstore using : get_serving_url
    • You can change the size of the served image. The original is not changed
    • Google will serve the images almost for free for you. You do not need a handler. You only pay the bandwidth

    Here is an example. You can change the =s0, to change the size. s0 returns the original size.

    https://lh6.ggpht.com/1HjICy6ju1e2GIg83L0qdliUBmPHUgKV8FP3QGK8Qf2pHVBfwkpO_V38ifAPm-9m20q_3ueZzdRCYQNyDE3pmA695iaLunjE=s0
    

    get_serving_url docs: https://developers.google.com/appengine/docs/python/images/functions

    Code :

    class Dynamic(db.Model):          # key : name
        name = db.StringProperty() 
        blob_ref = blobstore.BlobReferenceProperty()
        serving_url = db.LinkProperty()
    
    dyn= Dynamic.get_by_key_name(key_name)
    try :       # get url with size = 0
        dyn.serving_url = images.get_serving_url(dyn.blob_ref, size=None, secure_url=True)
    except DeadlineExceededError : 
        try :             # sometimes this request fails, retry. This always works fine
            dyn.serving_url = images.get_serving_url(dyn.blob_ref, size=None, secure_url=True)
        except DeadlineExceededError :
            logging.error('Image API get_serving_url deadline error after retry' %(dyn.key().name()))                        
            return None
        dyn.put()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to crop an image using images library of google app engine. The
I am using the PIL (python image library) to crop a very large image
I am using Tesseract OCR (via pytesser ) and PIL (Python Image Library) for
Hy, i'm using PIL (Python Image Library) without the lib-freetype. Is there a possibility
Is it possible to use the google app engine python imaging library, from a
^ As above. Is this possible? I'm using a library to get image data
Hi I'm trying to install the python image library at www.pythonware.com/products/pil and am getting
I am using the Python Imaging Library to colorize a black and white image
I'm trying to make all white pixels transparent using the Python Image Library. (I'm
I'm currently writing a simple Python (2.7) program using the Python Image Library .

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.