[ocrfeeder] Lower the PDF imported images' resolution



commit 4291c95b8911552894cde4417a1ea255a6e62710
Author: Joaquim Rocha <jrocha igalia com>
Date:   Tue Mar 9 13:38:45 2010 +0100

    Lower the PDF imported images' resolution
    
    Make images imported from PDF use a resolution of 300x300 instead of 600x600 so it is faster to convert PDFs.

 util/lib.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/util/lib.py b/util/lib.py
index 22f8759..5ae6a86 100644
--- a/util/lib.py
+++ b/util/lib.py
@@ -45,12 +45,15 @@ def convertPdfToImages(pdf_file, temp_dir = '/tmp'):
         os.mkdir(dir_name)
     except:
         pass
-    command = 'gs -SDEVICE=jpeg -r600x600 -sPAPERSIZE=letter ' \
+    debug('Converting PDF: ', pdf_file, ' to image')
+    resolution = 300
+    command = 'gs -SDEVICE=jpeg -r%(resolution)sx%(resolution)s -sPAPERSIZE=letter ' \
               '-sOutputFile="%(temp_name)s/%(file_name)s_%%04d.jpg" ' \
               '-dNOPAUSE -dBATCH -- "%(pdf_file)s"' % \
               {'temp_name': dir_name,
                'file_name': os.path.basename(pdf_file),
-               'pdf_file': pdf_file}
+               'pdf_file': pdf_file,
+               'resolution': resolution}
     os.popen(command)
     return dir_name
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]