James R. Barlow
a5efc4af9b
unpaper: replace input pnm with png
...
Unpaper or its underlying libraries don't seem to accept pnms with an
odd integer width. Although it's not clear if this is the issue at all.
In any case, keeping the image a PNG works around the issue. unpaper
only accepted PNM input in the past, which is why we send it PNM.
Since it now accepts PNG, we might as well use PNG.
Unpaper can write PNG as output too, but this added a few seconds to
the test suite was not committed.
Related issues:
https://github.com/ocrmypdf/OCRmyPDF/issues/887
https://github.com/ocrmypdf/OCRmyPDF/issues/665
https://github.com/unpaper/unpaper/issues/82
2022-07-03 15:32:16 -07:00
James R. Barlow
b062c9e8c0
pluginspec: hint that optimize may need to implement initialize
...
[ci skip]
2022-06-19 01:35:30 -07:00
James R. Barlow
8c58e95c3a
Add new initialize hookspec to make suppress plugins easier
2022-06-19 00:31:42 -07:00
James R. Barlow
e4c45e3d3b
Plugins should ideally not import from ocrmypdf._*
2022-06-18 16:03:55 -07:00
James R. Barlow
d8753dc790
Fix Windows issue if no exception
2022-06-13 01:46:59 -07:00
James R. Barlow
17a5b8b43c
Refactor reporting of optimization failures
2022-06-13 01:30:15 -07:00
James R. Barlow
13d11e76e5
optimize plugin: solve linearization and "is optimization enabled?" issues
2022-06-13 00:59:41 -07:00
James R. Barlow
61069660a2
Move optimization options to plugin
2022-06-12 02:42:16 -07:00
James R. Barlow
685a06c93d
Move optimize into a builtin plugin
2022-06-12 02:23:13 -07:00
James R. Barlow
10245dc954
Refactor a helper to use the Python API eventually
2022-06-12 00:31:01 -07:00
James R. Barlow
db9a22c9dd
api: call enable_ansi_support unconditionally
...
coloredlogs documentation says this is (now?) permitted.
Also import it from the right place.
2022-06-12 00:31:01 -07:00
James R. Barlow
31683530f8
api/cli: replace private variable access with method
2022-06-12 00:31:01 -07:00
James R. Barlow
0e550a1c6d
graft: use pikepdf's random name API instead of our own
...
Minor change to PDF output.
2022-06-12 00:31:01 -07:00
James R. Barlow
b17fb61389
Configure pylint in pyproject and delint
2022-06-12 00:30:44 -07:00
James R. Barlow
d640c2ded3
Tidy some if condition -> EAFP
2022-06-11 00:21:21 -07:00
James R. Barlow
a0ac448d52
Tidy some old-school %s strings
2022-06-11 00:15:19 -07:00
James R. Barlow
21cacad93b
unpaper: super syntax
2022-06-02 17:05:59 -07:00
James R. Barlow
3589f4e7d1
unpaper: fix unsaved change
2022-06-02 02:22:48 -07:00
James R. Barlow
e05f9575a8
Merge remote-tracking branch 'origin/master'
2022-06-02 01:57:39 -07:00
James R. Barlow
10c703e119
unpaper: use TemporaryDirectory(ignore_cleanup_errors=True) where available
...
Fixes #974 when used in conjunction with Python 3.10.
Reviewed other uses of TemporaryDirectory in ocrmypdf and decided it
was not worth fixing them since neither are exactly production code.
2022-06-02 01:56:41 -07:00
Robert Schütz and GitHub
808b24d59f
ignore PermissionError when calling os.nice() ( #973 )
2022-05-28 18:07:54 -07:00
James R. Barlow
6c427f82ea
Add test case for corrupt ICC profiles
2022-05-26 00:41:19 -07:00
James R. Barlow
e7a44ba87a
info: adjust ICC warning message
2022-05-26 00:21:31 -07:00
James R. Barlow
c311768452
Merge branch 'corrupt-icc' of https://github.com/oscherler/OCRmyPDF into oscherler-corrupt-icc
2022-05-26 00:14:47 -07:00
James R. Barlow
87838127b0
info: replace introspection with explicit f-string
2022-05-25 13:16:40 -07:00
Olivier Scherler
4db4df5c72
Log a warning instead of failing on images with a corrupt ICC profile.
2022-05-25 12:37:21 +02:00
leonnicolas and GitHub
603da52026
Fix small typo in update api.py ( #963 )
...
[ci skip]
2022-05-14 21:45:23 -07:00
James R. Barlow
33bfba8449
ghostscript: match actual reported version
2022-04-03 23:35:30 -07:00
James Barlow
84b9d4d021
Speculation: Ghostscript 9.56 new PDF interpreter breaks things
2022-04-03 21:14:19 -07:00
James Barlow
776ada6713
Upgrade pre-commit and associated tools; various lints
2022-04-03 20:53:01 -07:00
James Barlow
f29fe7f23e
Fix Pillow deprecation warnings
2022-04-03 13:30:50 -07:00
James R. Barlow
8182fe9c92
Make --use-threads default and update release notes
...
Re: issue Hanging on Random Files #814
2022-03-13 00:37:06 -08:00
James R. Barlow
1950acfbda
docs: proofread plugins
2022-02-20 00:56:43 -08:00
James R. Barlow
3546479658
optimize: don't deflate JPEGs with fancy DecodeParms settings
...
This is overly cautious but will do for now.
2022-02-18 23:36:53 -08:00
James R. Barlow
72442fa3d0
Fix error messages when run with pikepdf 5.0.0
...
Appears that these are spurious errors from qpdf probing the /DecodeParms
dict on images that don't have it.
Not sure exactly why it happens but this can be safely ignored.
2022-02-18 23:35:44 -08:00
James R. Barlow
cb05c1d122
pdfinfo: a few annotations
2022-02-14 23:31:53 -08:00
James R. Barlow
514038d4ec
optimize: recognize and produce [/FlateDecode /DCTDecode] images
2022-02-08 00:38:08 -08:00
James R. Barlow
50d76e7f6c
optimize: remove comment about issue in Pillow that is now fixed
2022-02-07 22:18:20 -08:00
James R. Barlow
6c78a46285
optimize: remove inaccurate about ICCs
...
pikepdf will now get the ICC profile out and put it in the JPEG.
2022-02-07 19:42:13 -08:00
James R. Barlow
863d560632
optimize: clarify log message about skipping images with multiple filters
2022-02-06 22:41:10 -08:00
James R. Barlow
3dfde479e2
The world is not ready for :=
2022-01-26 00:16:51 -08:00
James R. Barlow
3b406112d0
ghostscript: improve test coverage of error cases
2022-01-25 23:45:47 -08:00
James R. Barlow
fcc4c2d371
ghostscript: improve error message if image cannot be opened
2022-01-25 23:12:51 -08:00
James R. Barlow
3de18ed612
tesseract: account for more tesseract 5 output differences
2022-01-25 00:19:49 -08:00
James R. Barlow
93cca42e20
optimize: don't try to optimize an image we can't save
2022-01-25 00:19:23 -08:00
James R. Barlow
2d0ac4707c
Use better img2pdf settings where possible while supporting old versions
...
Fixes #894
2022-01-14 11:55:54 -08:00
James R. Barlow
7d208175cf
unpaper: refactoring
2022-01-11 10:57:54 -08:00
James R. Barlow
ea69e868ed
unpaper: issue warning if image too large to clean
2022-01-11 10:44:38 -08:00
Anton Gladky and GitHub
5acbd7a252
Wrap exception on non-CMYK images into the log warning ( #881 )
2021-12-29 01:15:49 -08:00
Krasimir Nedelchev and GitHub
aed955ca8c
Fix typo ( #882 )
2021-12-27 15:36:19 -08:00