Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: imageConversion.py

Issue 4663693082099712: Issue 1897 - Compress auto-generated images with pngout (Closed)
Patch Set: Fixed grammar in comment Created Feb. 10, 2015, 9:57 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« imageCompression.py ('K') | « imageCompression.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: imageConversion.py
===================================================================
--- a/imageConversion.py
+++ b/imageConversion.py
@@ -6,7 +6,6 @@
import os
import re
-from StringIO import StringIO
try:
from PIL import Image
@@ -15,6 +14,8 @@
import Image
import ImageOps
+from imageCompression import image_to_file
+
def get_alpha(image):
if image.mode in ('RGBA', 'LA'):
return image.split()[image.getbands().index('A')]
@@ -95,7 +96,8 @@
args = re.split(r'\s*,\s*', args) if args else ()
image = globals()['filter_' + filter](image, baseDir, *args)
- f = StringIO()
- f.name = filename
- image.save(f)
- files[filename] = f.getvalue()
+ file = image_to_file(image, filename)
+ try:
+ files[filename] = file.read()
+ finally:
+ file.close()
« imageCompression.py ('K') | « imageCompression.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld