Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6fe32bbaf7 | ||
|
|
4abb20390d | ||
|
|
daa3916430 | ||
|
|
e9b87cefcc | ||
|
|
60593b5ad3 | ||
|
|
cb3ba8e973 | ||
|
|
7e5c37137b | ||
|
|
1aae11714b | ||
|
|
d82f14a7aa | ||
|
|
4b65e0b093 | ||
|
|
43b0faa830 | ||
|
|
8674c9fb20 | ||
|
|
ccfbb54e8c | ||
|
|
9893ebf889 | ||
|
|
303eb3e93a | ||
|
|
ca546d70e5 | ||
|
|
6a5ea2d64a |
+22
-17
@@ -1,26 +1,31 @@
|
|||||||
tmp/
|
# Development environment
|
||||||
log/
|
|
||||||
*.pyc
|
*.pyc
|
||||||
tests/output/
|
|
||||||
.ruffus_history.sqlite
|
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
/*.pdf
|
|
||||||
build/
|
|
||||||
dist/
|
|
||||||
*.egg-info/
|
|
||||||
venv/
|
|
||||||
venv-3.4/
|
venv-3.4/
|
||||||
venv-3.5/
|
venv-3.5/
|
||||||
*/test/output
|
venv/
|
||||||
bin/
|
|
||||||
include/
|
|
||||||
lib/
|
|
||||||
pip-selfcheck.json
|
|
||||||
pyvenv.cfg
|
pyvenv.cfg
|
||||||
htmlcov/
|
|
||||||
.coverage
|
# Package building
|
||||||
|
*.egg-info/
|
||||||
.cache/
|
.cache/
|
||||||
|
.eggs/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Automatically generated files
|
||||||
|
ocrmypdf/lib/_*.py
|
||||||
|
ocrmypdf/version.py
|
||||||
|
|
||||||
|
# Code coverage
|
||||||
|
.coverage
|
||||||
|
htmlcov/
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
log/
|
||||||
|
/*.pdf
|
||||||
.ipynb_checkpoints/
|
.ipynb_checkpoints/
|
||||||
tests/cache/
|
tests/cache/
|
||||||
|
tests/output/
|
||||||
tests/resources/private
|
tests/resources/private
|
||||||
ocrmypdf/version.py
|
tmp/
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# OCRmyPDF
|
# OCRmyPDF
|
||||||
#
|
#
|
||||||
# VERSION 3.0.2
|
# VERSION 3.2
|
||||||
FROM debian:stretch
|
FROM debian:stretch
|
||||||
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# OCRmyPDF polyglot
|
# OCRmyPDF polyglot
|
||||||
#
|
#
|
||||||
# VERSION 3.0.2
|
# VERSION 3.2
|
||||||
FROM jbarlow83/ocrmypdf:latest
|
FROM jbarlow83/ocrmypdf:latest
|
||||||
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
MAINTAINER James R. Barlow <jim@purplerock.ca>
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -11,12 +11,7 @@ Main features
|
|||||||
`PDF/A <https://en.wikipedia.org/?title=PDF/A>`__ file from a regular PDF
|
`PDF/A <https://en.wikipedia.org/?title=PDF/A>`__ file from a regular PDF
|
||||||
- Places OCR text accurately below the image to ease copy / paste
|
- Places OCR text accurately below the image to ease copy / paste
|
||||||
- Keeps the exact resolution of the original embedded images
|
- Keeps the exact resolution of the original embedded images
|
||||||
|
- When possible, inserts OCR information as a "lossless" operation without rendering vector information
|
||||||
- or if requested oversamples the images before OCRing so as to get
|
|
||||||
better results
|
|
||||||
|
|
||||||
- When possible, inserts OCR information as a "lossless" operation without transcoding
|
|
||||||
images or rendering vector information
|
|
||||||
- Keeps file size about the same
|
- Keeps file size about the same
|
||||||
- If requested deskews and/or cleans the image before performing OCR
|
- If requested deskews and/or cleans the image before performing OCR
|
||||||
- Validates input and output files
|
- Validates input and output files
|
||||||
|
|||||||
+26
-6
@@ -6,16 +6,36 @@ 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-rc1:
|
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:
|
||||||
|
=====
|
||||||
|
|
||||||
New features
|
New features
|
||||||
------------
|
------------
|
||||||
|
|
||||||
- Lossless reconstruction: when possible, OCRmyPDF will inject text layers without transcoding
|
- Lossless reconstruction: when possible, OCRmyPDF will inject text layers without
|
||||||
images or otherwise manipulating the PDF.
|
otherwise manipulating the content and layout of a PDF page. For example, a PDF containing a mix
|
||||||
- New argument --tesseract-pagesegmode allows you to pass page segmentation arguments to Tesseract OCR.
|
of vector and raster content would see the vector content preserved. Images may still be transcoded
|
||||||
|
during PDF/A conversion. (``--deskew`` and ``--clean-final`` disable this mode, necessarily.)
|
||||||
|
- New argument ``--tesseract-pagesegmode`` allows you to pass page segmentation arguments to Tesseract OCR.
|
||||||
This helps for two column text and other situations that confuse Tesseract.
|
This helps for two column text and other situations that confuse Tesseract.
|
||||||
|
- Added a new "polyglot" version of the Docker image, that generates Tesseract with all languages packs installed,
|
||||||
|
for the polyglots among us. It is much larger.
|
||||||
|
|
||||||
|
Changes
|
||||||
|
-------
|
||||||
|
|
||||||
|
- JPEG transcoding quality is now 95 instead of the default 75. Bigger file sizes for less degradation.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
v3.1.1:
|
v3.1.1:
|
||||||
@@ -40,7 +60,7 @@ Changes
|
|||||||
- Fixed an issue where OCRmyPDF failed to text that certain pages contained previously OCR'ed text,
|
- Fixed an issue where OCRmyPDF failed to text that certain pages contained previously OCR'ed text,
|
||||||
such as OCR text produced by Tesseract 3.04
|
such as OCR text produced by Tesseract 3.04
|
||||||
- Inserts /Creator tag into PDFs so that errors can be traced back to this project
|
- Inserts /Creator tag into PDFs so that errors can be traced back to this project
|
||||||
- Added new option --pdf-renderer=auto, to let OCRmyPDF pick the best PDF renderer.
|
- Added new option ``--pdf-renderer=auto``, to let OCRmyPDF pick the best PDF renderer.
|
||||||
Currently it always chooses the 'hocrtransform' renderer but that behavior may change.
|
Currently it always chooses the 'hocrtransform' renderer but that behavior may change.
|
||||||
- Set up Travis CI automatic integration testing
|
- Set up Travis CI automatic integration testing
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ def generate_pdfa(pdf_pages, output_file, threads=1):
|
|||||||
"-sDEVICE=pdfwrite",
|
"-sDEVICE=pdfwrite",
|
||||||
"-sColorConversionStrategy=/RGB",
|
"-sColorConversionStrategy=/RGB",
|
||||||
"-sProcessColorModel=DeviceRGB",
|
"-sProcessColorModel=DeviceRGB",
|
||||||
|
"-dJPEGQ=95",
|
||||||
"-dPDFA=2",
|
"-dPDFA=2",
|
||||||
"-sPDFACompatibilityPolicy=2",
|
"-sPDFACompatibilityPolicy=2",
|
||||||
"-sOutputICCProfile=srgb.icc",
|
"-sOutputICCProfile=srgb.icc",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/python3
|
#!/usr/bin/env python3
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Copyright (c) 2013-14: fritz-hh from Github
|
# Copyright (c) 2013-14: fritz-hh from Github
|
||||||
# (https://github.com/fritz-hh)
|
# (https://github.com/fritz-hh)
|
||||||
|
|||||||
+12
-6
@@ -165,9 +165,6 @@ 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",
|
||||||
@@ -592,9 +589,18 @@ 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'], options.oversample))
|
dpi = round(max(pageinfo['xres'], pageinfo['yres'],
|
||||||
with open(output_file, 'wb') as pdf:
|
options.oversample))
|
||||||
img2pdf.convert([image], dpi=dpi, outputstream=pdf)
|
imgsize = ((img2pdf.ImgSize.dpi, dpi), (img2pdf.ImgSize.dpi, dpi))
|
||||||
|
|
||||||
|
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')
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ def generate_hocr(input_file, output_hocr, language: list, tessconfig: list,
|
|||||||
badxml,
|
badxml,
|
||||||
'hocr'
|
'hocr'
|
||||||
] + tessconfig)
|
] + tessconfig)
|
||||||
print(args_tesseract)
|
|
||||||
p = Popen(args_tesseract, close_fds=True, stdout=PIPE, stderr=PIPE,
|
p = Popen(args_tesseract, close_fds=True, stdout=PIPE, stderr=PIPE,
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
try:
|
try:
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
ruffus>=2.6.3
|
ruffus==2.6.3
|
||||||
Pillow>=2.4.0
|
Pillow==3.1.1
|
||||||
reportlab>=3.1.44
|
reportlab==3.2.0
|
||||||
PyPDF2>=1.25.1
|
PyPDF2==1.25.1
|
||||||
git+https://github.com/jbarlow83/img2pdf.git@e9bcce0afc3720752ca53a991db93f911a1df709#egg=img2pdf-0.1.5.dev
|
img2pdf==0.2
|
||||||
|
|||||||
@@ -210,11 +210,11 @@ setup(
|
|||||||
],
|
],
|
||||||
use_scm_version={'version_scheme': 'post-release'},
|
use_scm_version={'version_scheme': 'post-release'},
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'ruffus',
|
'ruffus>=2.6.3',
|
||||||
'Pillow',
|
'Pillow>=2.4.0',
|
||||||
'reportlab',
|
'reportlab>=3.1.44',
|
||||||
'PyPDF2',
|
'PyPDF2>=1.25.1',
|
||||||
'img2pdf'
|
'img2pdf>=0.2.0'
|
||||||
],
|
],
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
entry_points={
|
entry_points={
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
import img2pdf
|
import img2pdf
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
VERSION_STRING = '''tesseract 3.04.00
|
VERSION_STRING = '''tesseract 3.04.00
|
||||||
@@ -40,9 +41,12 @@ def main():
|
|||||||
print('List of available languages (1):\neng', file=sys.stderr)
|
print('List of available languages (1):\neng', file=sys.stderr)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
elif sys.argv[-1] == 'hocr':
|
elif sys.argv[-1] == 'hocr':
|
||||||
|
inputf = sys.argv[-3]
|
||||||
output = sys.argv[-2]
|
output = sys.argv[-2]
|
||||||
with open(output + '.hocr', 'w', encoding='utf-8') as f:
|
with Image.open(inputf) as im, \
|
||||||
f.write(HOCR_TEMPLATE.format('1000', '1000'))
|
open(output + '.hocr', 'w', encoding='utf-8') as f:
|
||||||
|
w, h = im.size
|
||||||
|
f.write(HOCR_TEMPLATE.format(str(w), str(h)))
|
||||||
elif sys.argv[-1] == 'pdf':
|
elif sys.argv[-1] == 'pdf':
|
||||||
inputf = sys.argv[-3]
|
inputf = sys.argv[-3]
|
||||||
output = sys.argv[-2]
|
output = sys.argv[-2]
|
||||||
|
|||||||
Reference in New Issue
Block a user