blob: a52b6d3009b916203a4285d38a3069018d3e9d03 (
plain)
1
2
3
4
5
6
7
8
9
10
|
import cStringIO
from PIL import Image
def response(ctx, flow):
if flow.response.headers["content-type"] == ["image/png"]:
s = cStringIO.StringIO(flow.response.content)
img = Image.open(s).rotate(180)
s2 = cStringIO.StringIO()
img.save(s2, "png")
flow.response.content = s2.getvalue()
|