Compare commits

..
3 Commits
6 changed files with 35 additions and 42 deletions
+14 -8
View File
@@ -1,6 +1,6 @@
# OCRmyPDF # OCRmyPDF
# #
# VERSION 3.2 # VERSION 3.0.2
FROM debian:stretch FROM debian:stretch
MAINTAINER James R. Barlow <jim@purplerock.ca> MAINTAINER James R. Barlow <jim@purplerock.ca>
@@ -10,20 +10,26 @@ RUN useradd docker \
&& chown docker:docker /home/docker && chown docker:docker /home/docker
# Update system and install our dependencies # Update system and install our dependencies
# If this command takes too Docker hub's automated build will timeout,
# so try it in portions
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
locales \ locales \
ghostscript \
tesseract-ocr \
tesseract-ocr-deu tesseract-ocr-spa tesseract-ocr-eng tesseract-ocr-fra \
qpdf \
poppler-utils \
python3 \ python3 \
python3-pip \ python3-pip \
python3-venv \ python3-venv \
python3-reportlab \ python3-reportlab \
python3-pil \ python3-pil \
python3-wheel \ python3-wheel
unpaper
RUN apt-get install -y --no-install-recommends \
unpaper \
ghostscript \
qpdf \
poppler-utils
RUN apt-get install -y --no-install-recommends \
tesseract-ocr \
tesseract-ocr-deu tesseract-ocr-spa tesseract-ocr-eng tesseract-ocr-fra
# Enforce UTF-8 # Enforce UTF-8
# Borrowed from https://index.docker.io/u/crosbymichael/python/ # Borrowed from https://index.docker.io/u/crosbymichael/python/
+4 -1
View File
@@ -1,13 +1,16 @@
# OCRmyPDF polyglot # OCRmyPDF polyglot
# #
# VERSION 3.2 # VERSION 3.0.2
FROM jbarlow83/ocrmypdf:latest FROM jbarlow83/ocrmypdf:latest
MAINTAINER James R. Barlow <jim@purplerock.ca> MAINTAINER James R. Barlow <jim@purplerock.ca>
# Update system and install our dependencies # Update system and install our dependencies
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr-all tesseract-ocr-all
USER docker
# Must use array form of ENTRYPOINT # Must use array form of ENTRYPOINT
# Non-array form does not append other arguments, because that is "intuitive" # Non-array form does not append other arguments, because that is "intuitive"
ENTRYPOINT ["/application/docker-wrapper.sh"] ENTRYPOINT ["/application/docker-wrapper.sh"]
+1 -11
View File
@@ -6,18 +6,8 @@ Please always read this file before installing the package
Download software here: https://github.com/jbarlow83/OCRmyPDF/tags Download software here: https://github.com/jbarlow83/OCRmyPDF/tags
v3.2.1:
=======
Changes
-------
- Fixed issue #47 "convert() got and unexpected keyword argument 'dpi'" by upgrading to img2pdf 0.2
- Tweaked the Dockerfiles
v3.2: v3.2:
===== =========
New features New features
------------ ------------
+6 -12
View File
@@ -165,6 +165,9 @@ parser.add_argument(
'--skip-big', type=float, metavar='MPixels', '--skip-big', type=float, metavar='MPixels',
help="skip OCR on pages larger than the specified amount of megapixels, " help="skip OCR on pages larger than the specified amount of megapixels, "
"but include skipped pages in final output") "but include skipped pages in final output")
# parser.add_argument(
# '--exact-image', action='store_true',
# help="Use original page from PDF without re-rendering")
advanced = parser.add_argument_group( advanced = parser.add_argument_group(
"Advanced", "Advanced",
@@ -589,18 +592,9 @@ def select_image_layer(
re_symlink(page_pdf, output_file) re_symlink(page_pdf, output_file)
else: else:
pageinfo = get_pageinfo(image, pdfinfo, pdfinfo_lock) pageinfo = get_pageinfo(image, pdfinfo, pdfinfo_lock)
dpi = round(max(pageinfo['xres'], pageinfo['yres'], dpi = round(max(pageinfo['xres'], pageinfo['yres'], options.oversample))
options.oversample)) with open(output_file, 'wb') as pdf:
imgsize = ((img2pdf.ImgSize.dpi, dpi), (img2pdf.ImgSize.dpi, dpi)) img2pdf.convert([image], dpi=dpi, outputstream=pdf)
layout_fun = img2pdf.get_layout_fun(None, imgsize, None, None, None)
with open(image, 'rb') as imfile, \
open(output_file, 'wb') as pdf:
rawdata = imfile.read()
pdf.write(img2pdf.convert(
rawdata, producer="img2pdf", with_pdfrw=False,
layout_fun=layout_fun))
@active_if(options.pdf_renderer == 'hocr') @active_if(options.pdf_renderer == 'hocr')
+5 -5
View File
@@ -1,5 +1,5 @@
ruffus==2.6.3 ruffus>=2.6.3
Pillow==3.1.1 Pillow>=2.4.0
reportlab==3.2.0 reportlab>=3.1.44
PyPDF2==1.25.1 PyPDF2>=1.25.1
img2pdf==0.2 git+https://github.com/jbarlow83/img2pdf.git@e9bcce0afc3720752ca53a991db93f911a1df709#egg=img2pdf-0.1.5.dev
+5 -5
View File
@@ -210,11 +210,11 @@ setup(
], ],
use_scm_version={'version_scheme': 'post-release'}, use_scm_version={'version_scheme': 'post-release'},
install_requires=[ install_requires=[
'ruffus>=2.6.3', 'ruffus',
'Pillow>=2.4.0', 'Pillow',
'reportlab>=3.1.44', 'reportlab',
'PyPDF2>=1.25.1', 'PyPDF2',
'img2pdf>=0.2.0' 'img2pdf'
], ],
tests_require=tests_require, tests_require=tests_require,
entry_points={ entry_points={