From 60b2eb14553eda314c85148b8f7f9ba2d60e4deb Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 16 Feb 2016 07:29:20 -0800 Subject: [PATCH] Fix JPEG DPI: Pillow expects dpi=(x,y) --- ocrmypdf/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocrmypdf/main.py b/ocrmypdf/main.py index f6152aaa..350298cc 100755 --- a/ocrmypdf/main.py +++ b/ocrmypdf/main.py @@ -677,7 +677,10 @@ def select_image_for_pdf( if all(image['enc'] == 'jpeg' for image in pageinfo['images']): # If all images were JPEGs originally, produce a JPEG as output im = Image.open(image) - dpi = im.info.get('dpi', int(pageinfo['xres'])) + dpi = im.info.get( + 'dpi', + (int(pageinfo['xres']), int(pageinfo['yres'])) + ) im.save(output_file, format='JPEG', dpi=dpi) else: re_symlink(image, output_file)