Commit fb8afa5c authored by Michal Čihař's avatar Michal Čihař

Optimize images a bit before serving

parent bf9d21bc
...@@ -94,7 +94,7 @@ def render_activity(activity): ...@@ -94,7 +94,7 @@ def render_activity(activity):
# Render surface to PNG # Render surface to PNG
out = StringIO() out = StringIO()
image.save(out, 'PNG') image.convert('P', palette=Image.ADAPTIVE).save(out, 'PNG')
# Return response # Return response
return HttpResponse(content_type='image/png', content=out.getvalue()) return HttpResponse(content_type='image/png', content=out.getvalue())
......
...@@ -220,7 +220,7 @@ class Widget(object): ...@@ -220,7 +220,7 @@ class Widget(object):
Returns PNG data. Returns PNG data.
''' '''
out = StringIO() out = StringIO()
self.image.save(out, 'PNG') self.image.convert('P', palette=Image.ADAPTIVE).save(out, 'PNG')
return out.getvalue() return out.getvalue()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment