mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-29 19:08:44 +00:00
11 lines
330 B
Python
11 lines
330 B
Python
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()
|