2012-01-26 43 views

回答

5

你會使用ImageService這實際上只能返回JPEG,PNG和WEBP,但可以讀取BMP。

0
bmp_file = 'foo.bmp' 
jpg_file = 'foo.jpg' 
import google.appengine.api.images 
with open(bmp_file, 'rb') as bmp_fd: 
    image = google.appengine.api.images.Image(bmp_file.read()) 
with open(jpg_file, 'wb') as jpg_fd: 
    jpg_fd.write(image.execute_transforms(output_encoding=google.appengine.api.images.JPEG)) 
+1

除了你不能寫在App Engine上的文件,上傳的圖片是不是他的本地文件系統中。 –