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
a9ad805347
optimize: Remove shim for unsupported pikepdf version
2021-01-31 00:08:20 -08:00
James R. Barlow
ef1e7a814e
Delinting
2021-01-26 01:45:04 -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
James R. Barlow
671c88d3b5
optimize: exclude images with custom Decode tables
2019-09-03 23:37:23 -07:00
James R. Barlow
b2cfaedf91
optimize: Don't reinsert 1bpp images
...
There seems to be version to version inconsistencies between
Leptonica's photometric interpretation of 1bpp images, in
particular commit a0692307 introduces a change to force transcoding
in this situation.
However, I never entirely got to the bottom of where the problem
is, and in any event 1bpp images are probably better optimized
by JBIG2 than pngquant, so we're going to stop running them through
pngquant.
2019-09-03 23:26:13 -07:00
James R. Barlow
b0d9775343
Attempt to resolve black-inversion issue
2019-08-31 01:25:36 -07:00
James R. Barlow
db4598f76a
Add PDF linearization
2019-07-27 16:15:48 -07:00
James R. Barlow
5f00e4f9d8
Sort imports
2019-07-27 04:51:52 -07:00
James R. Barlow
7117dc10de
Suppress noisy empty debug messages
2019-07-11 01:23:01 -07:00
James R. Barlow
9444cf357b
optimize: add divide by zero check
2019-06-04 02:01:53 -07:00
James R. Barlow
db6aa22eae
Progress bar: unit types
2019-05-23 02:00:47 -07:00
James R. Barlow
09ca1bee97
Add progress bar to optimize and add option to disable it
2019-05-22 15:31:48 -07:00
James R. Barlow
56067b590b
Make re_symlink() not require a log object
2019-05-17 01:59:36 -07:00
mawi
c92ccc6134
fix: tests
2019-04-08 14:57:42 +02:00
mawi
783a128bd1
feat: move to sync (none ETL) implementation - remove ruffus
2019-04-04 21:02:38 +02:00
Martin Wind
b214aa5b38
feat: move to sync (none ETL) implementation
2019-04-03 19:59:43 +02:00
James R. Barlow
a27ee3ee8c
optimize: use Decode to invert 1bpp PNGs for now
2019-03-03 17:50:12 -08:00
James R. Barlow
66586bdaab
optimize: Disable jpg->png migration
...
Needs more testing before release
2019-03-03 14:59:59 -08:00
James R. Barlow
01d2ea309f
Fix Predictor name and photometric flip
2019-03-03 14:57:15 -08:00
James R. Barlow
4f69ace868
optimize: fix all JBIG2 images binned on last page
...
During some past refactor it appears we now end up treating
all JBIG2 images as if they appeared on the last page in the
file. This bug had no visual side ffects but probably led to
suboptimal JBIG2 encoding.
2019-03-03 03:28:17 -08:00
James R. Barlow
497c531112
optimize: update comments
2019-03-03 03:28:17 -08:00
James R. Barlow
b27b92fbf3
optimize: on aggressive settings try JPG to PNG transcoding
...
If the color count of an image is low such as when black and white
documents are scanned in color, PNG with lossy quantization may
produce a superior encoding to JPEG. This is expensive to test however.
2019-03-03 03:28:17 -08:00