Merge branch 'master' into develop

This commit is contained in:
James R. Barlow
2016-10-14 15:56:58 -07:00
8 changed files with 81 additions and 46 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ Install the required Tesseract OCR engine with the language packs you plan to us
.. code-block:: bash
brew install tesseract # Option 1: for English, French, German, Spanish
brew install tesseract # Option 1: for English
.. code-block:: bash
+7
View File
@@ -4,6 +4,13 @@ RELEASE NOTES
OCRmyPDF uses `semantic versioning <http://semver.org/>`_.
v4.2.5:
=======
- Fixed an issue (#100) with PDFs that omit the optional /BitsPerComponent parameter on images
- Removed non-free file milk.pdf
v4.2.4:
=======
+8 -2
View File
@@ -211,7 +211,10 @@ def _find_page_inline_images(page, pageinfo, contentsinfo):
image['name'] = str('inline-%02d' % n)
image['width'] = inline.settings['/W']
image['height'] = inline.settings['/H']
image['bpc'] = inline.settings['/BPC']
if '/BPC' in inline.settings:
image['bpc'] = inline.settings['/BPC']
else:
image['bpc'] = 8
image['color'] = FRIENDLY_COLORSPACE.get(inline.settings['/CS'], '-')
image['comp'] = FRIENDLY_COMP.get(image['color'], '?')
if '/F' in inline.settings:
@@ -244,7 +247,10 @@ def _find_page_regular_images(page, pageinfo, contentsinfo):
image['name'] = str(xobj)
image['width'] = pdfimage['/Width']
image['height'] = pdfimage['/Height']
image['bpc'] = pdfimage['/BitsPerComponent']
if '/BitsPerComponent' in pdfimage:
image['bpc'] = pdfimage['/BitsPerComponent']
else:
image['bpc'] = 8
# Fixme: this is incorrectly treats explicit masks as stencil masks,
# but good enough for now. Explicit masks have /ImageMask true but are
+1 -1
View File
@@ -1,2 +1,2 @@
[pytest]
norecursedirs = lib .pc
norecursedirs = lib .pc .git
+59 -39
View File
@@ -9,20 +9,28 @@ Files derived from free sources
These test resources come from free sources, under either public domain or Creative Commons licenses.
In some cases they were converted from one image format to another without other changes.
+---------------------+--------------------------------------------------------------------------------+
| File | Source |
+=====================+================================================================================+
| c02-22.pdf | `Project Gutenberg`_, Adventures of Huckleberry Finn, page 22 |
+---------------------+--------------------------------------------------------------------------------+
| congress.jpg | `US Congressional Records`_ (Public Domain) |
+---------------------+--------------------------------------------------------------------------------+
| graph.pdf | `Wikimedia: Pandas text analysis.png`_ (Public Domain) |
+---------------------+--------------------------------------------------------------------------------+
| lichtenstein.pdf | `Wikimedia: JPEG2000 Lichtenstein`_ (Creative Commons BY-SA 3.0) |
+---------------------+--------------------------------------------------------------------------------+
| LinnSequencer.jpg, | `Wikimedia: LinnSequencer`_ (Creative Commons BY-SA 3.0) |
| linn.pdf, linn.txt | |
+---------------------+--------------------------------------------------------------------------------+
.. list-table::
:widths: 20 50 30
:header-rows: 1
* - File
- Source
- License
* - c02-22.pdf
- `Project Gutenberg`_, Adventures of Huckleberry Finn, page 22
- Public Domain
* - congress.jpg
- `US Congressional Records`_
- Public Domain
* - graph.pdf
- `Wikimedia: Pandas text analysis.png`_
- Public Domain
* - lichtenstein.pdf
- `Wikimedia: JPEG2000 Lichtenstein`_
- Creative Commons BY-SA 3.0
* - LinnSequencer.jpg, linn.pdf, linn.txt
- `Wikimedia: LinnSequencer`_
- Creative Commons BY-SA 3.0
Files generated for this project
@@ -31,31 +39,43 @@ Files generated for this project
The following test resources were crafted specifically for this project, and can be used
under the terms of the license in LICENSE.rst.
+---------------------+-----------------------+---------------------------------------------------------+
| File | Contributor | Purpose |
+---------------------+-----------------------+---------------------------------------------------------+
| aspect.pdf | @jbarlow83 | test image with 200 x 100 DPI resolution |
+---------------------+-----------------------+---------------------------------------------------------+
| blank.pdf | @jbarlow83 | blank PDF |
+---------------------+-----------------------+---------------------------------------------------------+
| cmyk.pdf | @jbarlow83 | a CMYK image created in Photoshop |
+---------------------+-----------------------+---------------------------------------------------------+
| enormous.pdf | @jbarlow83 | very large PDF page |
+---------------------+-----------------------+---------------------------------------------------------+
| francais.pdf | @jbarlow83 | a page containing French accents (diacritics) |
+---------------------+-----------------------+---------------------------------------------------------+
| hugemono.pdf | @jbarlow83 | large monochrome 35000x35000 image in JBIG2 encoding |
+---------------------+-----------------------+---------------------------------------------------------+
| invalid.pdf | @jbarlow83 | a PDF file header followed by EOF marker |
+---------------------+-----------------------+---------------------------------------------------------+
| masks.pdf | @supergrobi | file containing explicit masks and a stencil mask |
| | | drawn without a proper transformation matrix; printout |
| | | of a German Wikipedia article (Creative Commons BY-SA) |
+---------------------+-----------------------+---------------------------------------------------------+
| milk.pdf | @lowesjam | linearized PDF containing some indirect objects |
+---------------------+-----------------------+---------------------------------------------------------+
| missing_docinfo.pdf | @jbarlow83 | PDF file with no /DocumentInfo section |
+---------------------+-----------------------+---------------------------------------------------------+
.. list-table::
:widths: 20 20 60
:header-rows: 1
* - File
- Contributor
- Purpose
* - aspect.pdf
- @jbarlow83
- test image with 200 x 100 DPI resolution
* - blank.pdf
- @jbarlow83
- blank PDF
* - cmyk.pdf
- @jbarlow83
- a CMYK image created in Photoshop
* - enormous.pdf
- @jbarlow83
- very large PDF page
* - epson.pdf
- @lowesjam
- a linearized PDF containing some unusual indirect objects, created by an Epson printer; printout of a Wikipedia article (CC BY-SA)
* - francais.pdf
- @jbarlow83
- a page containing French accents (diacritics)
* - hugemono.pdf
- @jbarlow83
- large monochrome 35000x35000 image in JBIG2 encoding
* - invalid.pdf
- @jbarlow83
- a PDF file header followed by EOF marker
* - masks.pdf
- @supergrobi
- file containing explicit masks and a stencil mask drawn without a proper transformation matrix; printout of a German Wikipedia article (CC BY-SA)
* - missing_docinfo.pdf
- @jbarlow83
- PDF file with no /DocumentInfo section
Assemblies
==========
Binary file not shown.
Binary file not shown.
+5 -3
View File
@@ -124,8 +124,8 @@ def spoof_tesseract_big_image_error():
return spoof('tesseract', 'tesseract_big_image_error.py')
def test_quick(spoof_tesseract_noop):
check_ocrmypdf('c02-22.pdf', 'test_quick.pdf', env=spoof_tesseract_noop)
def test_quick(spoof_tesseract_cache):
check_ocrmypdf('ccitt.pdf', 'test_quick.pdf', env=spoof_tesseract_cache)
def test_deskew(spoof_tesseract_noop):
@@ -635,4 +635,6 @@ def test_masks(spoof_tesseract_noop):
def test_linearized_pdf_and_indirect_object(spoof_tesseract_noop):
check_ocrmypdf('milk.pdf', 'test_milk.pdf', env=spoof_tesseract_noop)
check_ocrmypdf(
'epson.pdf', 'test_epson.pdf',
env=spoof_tesseract_noop)