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() |