开发者

Error trying to transform image < 1 MB in App Engine

开发者 https://www.devze.com 2022-12-22 21:19 出处:网络
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 o开发

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 o开发者_StackOverflow中文版f 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?


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


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消