Anton Gladky and GitHub
5acbd7a252
Wrap exception on non-CMYK images into the log warning ( #881 )
2021-12-29 01:15:49 -08:00
James R. Barlow
3810e576ff
optimize: fix mypy lint
2021-11-13 14:48:00 -08:00
James R. Barlow
42bf5476dd
optimize: replace leptonica compdata with direct insert of JPEG
...
Confirmed that img2pdf just inserts JPEG verbatim. Never had to go through
the trouble we did.
2021-11-12 23:20:49 -08:00
James R. Barlow
1c4d5d79f7
Improve some error messages
2021-10-28 01:16:22 -07:00
James R. Barlow
690f88119d
Fix test failures on pikepdf 3.2.0 + pybind11 2.8.0
...
When compiled without pybind11 2.8.0, pikepdf supplies a shim to implement
pikepdf._ObjectMapping.values() which has subtly different semantics
from a true dict-like objects; in particular it supports
next(objectmap.values())
where a standard dict requires
next(iter(objectmap.values()).
pybind11 2.8.0 now implements .values() properly, meaning some misuses of
protocol in ocrmypdf fail.
If pybind11 < 2.8.0, pikepdf will
continue to offer its shim. If pybind11 >= 2.8.0, pikepdf does not add its shim.
Consequently no changes were needed in pikepdf.
Closes #843
2021-10-12 13:38:52 -07:00
James R. Barlow
c725bf79da
flake8 delinting
2021-09-21 16:37:03 -07:00
James R. Barlow
9559f76fae
optimize: fix typo in debug msg
2021-09-19 16:31:00 -07:00
James R. Barlow
b4b32a35b5
optimize: fix typing consistency
2021-09-15 00:09:08 -07:00
James R. Barlow
6f9b948064
typing: fix some trivial issues
2021-08-26 23:46:44 -07:00
James R. Barlow
2a09a668f6
Delinting: unused args
2021-04-07 02:18:08 -07:00
James R. Barlow
ec1d585d40
Merge branch 'feature/misc-breaking'
2021-04-01 16:51:04 -07:00
James R. Barlow
a4e1f8e1f3
Merge branch 'feature/lambda'
2021-04-01 16:36:22 -07:00
James R. Barlow
0a42934c08
Exclude Group 3 images from optimization
2021-03-20 23:28:21 -07:00
James R. Barlow
8ffc99f648
optimize: log errors more loudly
2021-03-03 00:43:40 -08:00
James R. Barlow
2a52c6dec2
optimize: skip images with unusually small dimensions
...
They're unlikely to be handled well by our recompressors. It seems
that JBIG2 cannot handle very small widths.
Fixes #732
2021-02-14 01:43:25 -08:00
James R. Barlow
9cba738b48
Remove deprecated code
2021-01-31 19:27:59 -08:00
James R. Barlow
b1da09f141
Add plugin for setting logging console
...
So that we are not tied to tqdm.
2021-01-31 02:29:11 -08:00
James R. Barlow
42c84531e4
optimize: rewrite JPEG optimize to avoid use of tqdm and parallelize
...
For some reason JPEG optimization was not done in parallel, and was
perhaps never done in parallel. Strange oversight.
2021-01-31 02:18:46 -08:00
James R. Barlow
a9ad805347
optimize: Remove shim for unsupported pikepdf version
2021-01-31 00:08:20 -08:00
James R. Barlow
d274d88929
Refactor to eliminate global state in _concurrent
2021-01-30 17:36:30 -08:00
James R. Barlow
ef1e7a814e
Delinting
2021-01-26 01:45:04 -08:00
James R. Barlow
6a8dd65aa2
lambda: more issues related to new executor semantics
...
Now all tests pass, except for:
-tests that check the progress bar
-tests where xdist may or may not load a _lambda_plugin by running
some other test first before a test in optimize
2021-01-24 23:46:40 -08:00
James R. Barlow
2846d46bb8
Remove .coveragerc and fold into setup.cfg
2021-01-06 03:58:18 -08:00
James R. Barlow
b4c1f66bc1
typing: tidy up
2020-12-11 14:14:21 -08:00
James R. Barlow
54bbbfdeb3
Fix UnboundLocalError when considering ImageMasks for optimization
...
Uncovered by test file in issue 667, although unrelated to that issue.
2020-11-03 01:08:14 -08:00
Edward Betts and GitHub
2def7e3392
Use % for percentage in string format ( #643 )
2020-10-27 23:09:14 -07:00
James R. Barlow
204c9d6ae1
Fix inverted colors during JBIG2 optimization on paletted images
...
Fixes #640
2020-10-07 04:08:50 -07:00
James R. Barlow
4e15eb8d14
Fix image optimization discarding image masks and soft masks associated with PNGs
...
Fixes #648
2020-10-06 03:20:54 -07:00
James R. Barlow
3ef8872a1e
pngquant driver: refactor, use streams instead of temporary files
2020-09-25 00:18:02 -07:00
James R. Barlow
d464d3122e
Use img2pdf to create optimized PNG images
...
Fixes #629 , #620
2020-09-17 03:11:26 -07:00
James R. Barlow
aa0ec40102
Change license of all GPLv3 files to MPL-2.0
...
https://github.com/jbarlow83/OCRmyPDF/issues/600
2020-08-05 00:44:42 -07:00
James R. Barlow
a510b21b20
optimize: add typing for Xref, remove fspath()'s
2020-07-09 14:06:41 -07:00
James R. Barlow
373f27832b
optimize: improve typing of xref_exts
2020-07-07 22:41:29 -07:00
James R. Barlow
b20a6e4c5d
optimize: add type hints
2020-07-07 22:18:50 -07:00
James R. Barlow
49734d5456
optimize: fix incorrect to prevent re-optimizing JBIG2s
2020-07-07 21:52:11 -07:00
James R. Barlow
fe156db41d
Merge branch 'release/v10' into trialmerge
2020-06-09 15:12:56 -07:00
James R. Barlow
0f942fb714
Rename ocrmypdf.exec -> ocrmypdf._exec
2020-06-09 14:59:09 -07:00
James R. Barlow
75c34b873a
optimize: convert from executor to progress pool
2020-05-03 02:04:57 -07:00
James R. Barlow
c85278b31d
Delinting
2020-05-03 00:53:29 -07:00
James R. Barlow
5dbc080fa0
Rename PDFContext->PdfContext
2020-05-02 04:32:46 -07:00
James R. Barlow
e02f6c1e97
Support plugin invocation with API
2020-05-02 03:34:31 -07:00
James R. Barlow
43d650e78c
Fix issue where only first PNG-style image would be optimized
2020-04-25 03:50:11 -07:00
James R. Barlow
d146d2b65c
The Great Logging Refactor
...
Remove all instances of logger object being passed as parameters.
This was a holdover from ruffus, and complicated a lot of simple things.
2020-04-14 23:59:33 -07:00
James R. Barlow
99653fcd32
optimize: consider ICCBased 1 bit for optimization
2020-03-15 02:20:44 -07:00
James R. Barlow
72d3ee3a87
Refactor symlink usage to support Windows
2019-12-04 17:13:51 -08:00
James R. Barlow
4d26867dee
Delinting
2019-09-20 17:17:11 -07:00
James R. Barlow
cf4b04c5d1
optimize: work around pikepdf 1.6.3 limitation with indexed ICCbased colorspaces
2019-09-11 12:56:27 -07:00
James R. Barlow
1c3e90a892
optimize: solve monochrome by converting to G4
2019-09-04 00:51:47 -07:00
James R. Barlow
a650caa599
optimize: don't consider 1bpp images for PNG optimization
2019-09-03 23:47:20 -07:00
James R. Barlow
c6caff90a1
optimize: only re-insert pngs after pngquant
...
Previously we attempted to reinsert all PNGs, but it appears to be
unlikely that Leptonica's API is actually capable of optimizing the PNG
before it inserts it.
In any event qpdf has gained image optimization capabilities as well
which we coudld borrow.
2019-09-03 23:46:25 -07:00