You can use cStringIO to create an in-memory file handle, save to it from
PIL as normal, then store the contents of getvalue() in datastore. I just
completed a project that uses this method, and it works pretty well.
Side note, I've been storing the file base64 encoded as well, but I don't
know if that's strictly necessary.
On Friday, June 28, 2013 3:29:06 PM UTC-4, Pumplerod wrote:
>
> Thank you. Upon reading up on your suggestion I've found so much
> information that I've become even more confused.
>
> The docs say that writing to the blobstore is being depreciated and that
> one should write to the datastore but use blobstore to serve the file.
>
> Basically, I have a PIL.Image object created by: im =
> Image.fromstring('RGB',(width,height),pixels)
>
> I've tried creating a write location with: file_name =
> files.blobstore.create(mime_type='image/png')
> and then using: im.save(file_name,'PNG')
>
> but this does not work due to the "read only filesystem", so I'm getting
> lost.
> given my Image, what are the steps I need to follow to store and recover
> the image?
>
>
>
> On Thursday, June 27, 2013 6:53:51 AM UTC-7, martinc wrote:
>>
>> Sure, you can create a request handler to output image data to the
>> browser, however image processing can be rather slow so you probably want
>> to store the data in blob store or datastore and serve that. The advantage
>> of the blobstore is that you can get a URL to serve the image directly and
>> auto scale & crop for you.
>>
>> -Martin
>>
>> On Jun 26, 2013, at 11:32 PM, Pumplerod <[email protected]> wrote:
>>
>> > That's great. I hadn't realized that. Is there a way to write
>> directly to the browser? Or do I need to save the image back to the
>> datastore first?
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.