def embedd_image():
from google.appengine.api import images
img1 = images.Image('/home/ubuntu/a.png') // Here I am getting **error
img2 = images.Image('/home/ubuntu/text.png') // Here I am getting **error
composite = images.composite([(img1, 0, 0, 1.0, images.TOP_LEFT), (img2, 81, 25, 1.0, images.TOP_LEFT)], 144, 68, output_encoding=0)
return composite
**错误为Unrecognized image format
答案 0 :(得分:2)
来自docs:
class Image(image_data=None, blob_key=None)
...
image_data
图像数据 as bytestring (str)。图片 数据可以用JPEG,PNG,WEBP,GIF(包括动画),BMP编码, TIFF或ICO格式。
作为字节串:
img1 = images.Image(open('/home/ubuntu/a.png').read())