From 64253f1dca86e9af72fcb8e3297aed7538922117 Mon Sep 17 00:00:00 2001 From: nimaid Date: Sat, 4 Jul 2020 11:58:45 -0700 Subject: [PATCH] Fixed JPEGs not being closed correctly --- fpdf/fpdf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fpdf/fpdf.py b/fpdf/fpdf.py index e93037dc5..9ee3ab47a 100644 --- a/fpdf/fpdf.py +++ b/fpdf/fpdf.py @@ -1813,10 +1813,11 @@ def _parsejpg(self, filename): f.close() self.error('Missing or incorrect image file: %s. error: %s' % (filename, str(exception()))) - with f: # Read whole file from the start f.seek(0) data = f.read() + f.close() + return {'w':width,'h':height,'cs':colspace,'bpc':bpc,'f':'DCTDecode','data':data} def _parsegif(self, filename):