diff --git a/src/img2pdf.py b/src/img2pdf.py index db8778f..0029481 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -310,7 +310,11 @@ def convert(images, dpi=None, pagesize=(None, None), title=None, author=None, imgdata = imgdata.convert('RGB') color = imgdata.mode img = imgdata.tobytes() - imgdata.close() + # the python-pil version 2.3.0-1ubuntu3 in Ubuntu does not have the close() method + try: + imgdata.close() + except AttributeError: + pass imgdata = zlib.compress(img) im.close()