Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: WARNING: Could not execute identify to calculate DPI #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixes: WARNING: Could not execute identify to calculate DPI
Output:
````
identify -format "%w %x %h %y
" "example.pdf"

list index out of range
WARNING: Could not execute identify to calculate DPI (try installing imagemagick?), so defaulting to 300dpi
````
  • Loading branch information
rasa authored Nov 21, 2016
commit 0c526eaf593d0b0d87aad1ca83571e6ddf93a0b7
2 changes: 1 addition & 1 deletion pypdfocr/pypdfocr_gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _get_dpi(self, pdf_filename):
self.greyscale = greyscale

# Now, run imagemagick identify to get pdf width/height/density
cmd = 'identify -format "%%w %%x %%h %%y\n" "%s"' % pdf_filename
cmd = 'identify -format "%%w %%x %%h %%y\\n" "%s"' % pdf_filename
try:
out = subprocess.check_output(cmd, shell=True)
results = out.splitlines()[0]
Expand Down