views:

243

answers:

3

So I know that App Engine prevents working with images greater than 1 MB in size, but I'm getting a RequestTooLargeError when I call images.resize on an jpg that is 400K on disk. The dimensions of the jpg are 1600 x 1200, so is it that app engine can't handle resizing images over 1 megapixel, even if the image file itself is a compressed format that is smaller than 1 MB?

A: 

The image API would not raise a RequestTooLargeError (see exceptions related to image API here). It would indicate that your total request size is too big.

What other data are you sending over with the request? Although it probably would be hard to push the total request over 10MB (which is the maximum request size) if it's a fairly simple request (i.e. just uploading a single image).

tomlog
I'm fairly certain that it's related to the image call. When I comment out the image code, everything works. Furthermore, I see that others are hitting this too (where images.Transform() raises the RequestTooLargeError), e.g. http://groups.google.com/group/google-appengine/browse_thread/thread/2f5cb194e8f74aa1). Except they all are using images that are > 1MB to start, whereas I am not, hence my confusion.
ryan
A: 

This a is best guess... not an real answer.

Based on what I have read here and in some other threads, it seems like the image api has decompressed your image into a form that is larger than 1 MB and then proceeded to complain about the image that it created.

About the only way to prevent that is to cut your original image into chunks that will not be bigger than 640x520... But that will require some pretty heavy listing on the client side.

Added: This app engine issue regarding image size limits may have some helpful pointers

Added: You can probably leverage the finding that you had in your initial revision of this question... you said that crop worked but resize did not... This will allow you to keep most of the processing on the server-side.

Added: Another thread about the effects of small JPG that transforms into a larger image

vkraemer
A: 

Hi Ryan,

I am facing the same problem. Have you found the solution?

The image size I use is < 1MB. The format is JPG. After cropping, the image size becomes > 1MB, hence, when calling the resize function to resize the cropped image, I got the following exception:

com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call images.Transform() was too large

--Nick

Note really. I just instead upload the large files to the blobstore and use get_serving_url to crop/resize for smaller versions (see here for detail: http://code.google.com/appengine/docs/python/images/functions.html)
ryan