From e810f3baf4e70236f56df0b990c8eabe6c17a822 Mon Sep 17 00:00:00 2001 From: josch Date: Mon, 16 Feb 2015 19:19:49 +0100 Subject: [PATCH] close cStringIO and PIL.Image --- src/img2pdf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index 9f5629f..ab689b6 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -309,7 +309,10 @@ def convert(images, dpi=None, x=None, y=None, title=None, author=None, debug_out("Converting colorspace %s to RGB"%color, verbose) imgdata = imgdata.convert('RGB') color = imgdata.mode - imgdata = zlib.compress(imgdata.tostring()) + img = imgdata.tobytes() + imgdata.close() + imgdata = zlib.compress(img) + im.close() # pdf units = 1/72 inch if not x and not y: