[ocrfeeder] Remove the PDF file's extension from the images generated from it
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Remove the PDF file's extension from the images generated from it
- Date: Thu, 11 Mar 2010 08:49:12 +0000 (UTC)
commit a24bbe75ddd47a8b0068867d615d422f83dccd2f
Author: Joaquim Rocha <jrocha igalia com>
Date: Thu Mar 11 09:49:27 2010 +0100
Remove the PDF file's extension from the images generated from it
util/lib.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/util/lib.py b/util/lib.py
index 5ae6a86..08b4628 100644
--- a/util/lib.py
+++ b/util/lib.py
@@ -47,11 +47,12 @@ def convertPdfToImages(pdf_file, temp_dir = '/tmp'):
pass
debug('Converting PDF: ', pdf_file, ' to image')
resolution = 300
+ file_name = os.path.splitext(os.path.basename(pdf_file))[0]
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),
+ 'file_name': file_name,
'pdf_file': pdf_file,
'resolution': resolution}
os.popen(command)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]