【发布时间】:2014-06-04 12:47:07
【问题描述】:
我正在使用 GAE Image 服务调整各种图像的大小,如下所示:
from google.appengine.api images
img = images.Image(image_data=get_file_content(image_file_path))
img.resize(width=600)
thumbnail_data = img.execute_transforms(output_encoding=images.JPEG)
它工作正常,但对于动画 GIF 图像,execute_transforms 引发 LargeImageError。图像大小为 143KB,分辨率为 607x571px。这发生在 GAE 中,但不在我的本地开发服务器中。
在Images Python API Overview 中表示图像不得大于 32 兆字节。但事实并非如此。
【问题讨论】:
-
尝试一个非常小的动画 GIF(即 5x5 像素)。看看你是否得到同样的错误。
-
TBH 如果它能无缝转换动画 gif,我会感到惊讶...
-
@AndreiVolgin 我已经尝试过这个 40x40 图像fossies.org/linux/www/jquery-ui-1.10.4.custom.zip/… 并且在 GAE 中转换图像没有错误,但会产生完全黑色的图像,而在本地开发服务器中会产生正确的图像。然后我尝试了这张图片forums.autodesk.com/autodesk/attachments/autodesk/120/34295/1/…,结果在两种情况下都很好。
-
@PaulCollingwood 本地开发服务器可以毫无问题地缩放 GIF。但无论如何,如果 GIF 图像不兼容,那么为什么会引发 LargeImageError 错误? GAE 文档不应该说 GIF 不兼容吗?
-
@PaulCollingwood 在 GAE 文档中说动画 GIF 是兼容的 developers.google.com/appengine/docs/python/images/…
标签: python image google-app-engine python-imaging-library