0

この 1 年間、AppEngine の images API を問題なく使用しています。先週かそこらで突然、画像 API が画像を破損しているようです。画像 API を使用していくつかの異なる操作を行いますが、問題を引き起こしていると思われるのは、TIFF データに対して images.rotation(0) を実行して PNG に変換することです。(他のファイル形式の変換は試していませんが、要点は、これが 1 年以上機能していたのに、なぜ突然機能しなくなるのでしょうか? さらに、TIFF はインバウンド データの形式であるため、TIFF から PNG で機能する必要があります)。

これは長い間問題なく機能していましたが、今日突然、プロセスを通過する TIFF が出力で破損していることに気付きました。二重になって歪んでいるように見えます。

これは、AppEngine 1.7.7 で Python 2.7 API を使用しています。PIL 経由ではなく、Google images API を直接使用しています。

助けてください!これにより、本番環境が停止しています。

コード例:

from google.appengine.api import images
import webapp2

def get_sample():
    # sample.tiff is a 1bit black and white group3 tiff from a fax service
    with open("sample.tiff") as x: 
        f = x.read()
    return f

class MainHandler(webapp2.RequestHandler):
    def get(self):
        # Convert to PNG using AppEngine's images API by doing a rotation of 0 degrees.
        # This worked fine for over a year and now suddenly started corrupting the 
        # output image with a grainy double image that looks like two of the 
        # same image are layered on top of each other and vibrating.
        sample = get_sample()
        png = images.rotate(sample, 0)

        self.response.headers["Content-Type"] = "image/png"
        self.response.out.write(png)

application = webapp2.WSGIApplication([('/', MainHandler)], debug=True)
4

3 に答える 3

0

私はこれを使用して画像をロードしてきました.tiff画像は使用していませんが、それが問題になる可能性があります-おそらくPILを使用して画像を変換しますか?

class Image(BaseHandler):
    def get(self):
        employee = clockin.Employee.get(self.request.get("img_id"))
        if employee.avatar:
            self.response.headers['Content-Type'] = "image/png"
            image = images.resize(employee.avatar, 150, 150)
            self.response.out.write(image)
        else:
            self.response.out.write("No image")
于 2013-05-07T07:55:19.063 に答える