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
James R. Barlow
2e6ba2df8c
optimize: fix recoding of PNGs
...
Previously we opened pngquant-compressed PNGs with transcoding
because the transcode free function in Leptonica didn't seem to
work. This mean Leptonica may have thrown away the hard of
pngquant if didn't understand the encoding.
This change resolves the issue and allows us to open PNG encoded
data and insert it into a PDF without transcoding. Should improve
encoding quality.
2019-03-03 03:28:17 -08:00
James R. Barlow
0bf26b03ae
optimize: Modernize pikepdf usage
2019-02-16 14:03:10 -08:00
James R. Barlow
7d330afd81
Delinting
2019-01-02 13:34:45 -08:00
James R. Barlow
c771938907
Convert to f-strings where it makes sense
2018-12-31 15:01:19 -08:00
James R. Barlow
0880b16491
Sort imports with isort
2018-12-30 01:28:15 -08:00
James R. Barlow
06308a22ce
Reformat with black
2018-12-30 01:27:49 -08:00
James R. Barlow
72b920eb16
Drop support for Python 3.5
2018-12-30 00:23:26 -08:00
James R. Barlow
ed9bb985e2
Fix pikepdf 0.9.0
2018-12-14 23:21:13 -08:00
Stefan Weil and jbarlow83
a873278c2a
Fix some recommendations from LGTM ( #309 )
...
* Fix unreachable code
This fixes an issue reported by LGTM.
Signed-off-by: Stefan Weil <sw@weilnetz.de >
* Remove unused imports
This fixes several recommendations from LGTM.
Signed-off-by: Stefan Weil <sw@weilnetz.de >
2018-10-28 13:59:58 -07:00
James R. Barlow
00fc1a12e2
optimize: should remove unreference resources too
2018-10-19 00:03:56 -07:00
James R. Barlow
c1e18bb825
optimize: Exclude soft masks (SMasks) from optimization
...
Soft masks are only allowed to be of colorspace DeviceGray so we
shouldn't use pngquant on them. For now, avoid this exceptional
case by excluded soft masks from optimization.
2018-10-05 01:23:26 -07:00
James R. Barlow
58282ea0fb
optimize: more refactoring
...
Now properly generalized/specialized where it should be
2018-10-04 13:44:51 -07:00
James R. Barlow
891da7834c
optimize: refactor image extraction
2018-10-04 12:34:22 -07:00
James R. Barlow
5c229d48d5
optimize: Reorganize so JBIG2 can be performed on images reduced to 1bpp
...
Closes #297
2018-10-04 11:53:11 -07:00
James R. Barlow
5b84549716
Change JBIG2 lossy mode to require --jbig2-lossy
2018-10-04 01:20:49 -07:00
James R. Barlow
b32dd9f9d3
Fix lossless JBIG2 when there are multiple JBIG2 images on a single page
2018-10-03 17:40:26 -07:00
James R. Barlow
9a8ec4b210
optimize: only enable lossy JBIG2 for -O3
2018-10-03 00:38:58 -07:00
James R. Barlow
75aad4cc79
optimize: Refactor convert_to_jbig2
2018-10-02 23:42:12 -07:00
James R. Barlow
4b27feca98
optimize: Disable JBIG2 lossy mode, use lossless instead
2018-10-01 12:28:54 -07:00
James R. Barlow
677d9a4e76
Remove some unhelpful lambdas
2018-09-27 13:48:12 -07:00
James R. Barlow
4d5c9b8cdf
Fix error in optimize.py on PNGs at -O2
...
Error was
TypeError: unsupported operand type(s) for -: 'tuple' and 'int'
2018-08-20 15:45:34 -07:00
James R. Barlow
755f6e0979
optimize: Use new pikepdf Object.write API
2018-07-13 23:52:36 -07:00
James R. Barlow
95b2830d17
Support removal of Null from pikepdf
2018-07-13 23:50:35 -07:00
James R. Barlow
890c7fd0f6
optimize: allow modification of quality settings in command line mode
2018-07-02 23:48:51 -07:00
James R. Barlow
2974929b26
Make jpeg/png quality tunable args
2018-07-02 22:22:59 -07:00
James R. Barlow
0029cc4fe7
optimize: fix PNGs that were reduced to 1-bit being inverted
...
At some point the color gets flipped, we have to flip it again,
for mono.
Incidentally this exposed an unused
optimization. Should change the
first past to scan all images and
record monochrome xrefs, then optimize
JPEG and PNG, possibly adding
mono images to the monochrome
queue. Finally, do JBIG2 optimization.
2018-06-29 00:09:20 -07:00
James R. Barlow
434b96d734
optimize: skip incremental images if any
...
These are fairly rare
2018-06-24 00:18:48 -07:00
James R. Barlow
b9dc109892
optimize: use new pikepdf api for objgen
2018-06-24 00:16:28 -07:00
James R. Barlow
b0dbaeafc5
Cleanup unused imports
2018-06-23 01:47:53 -07:00
James R. Barlow
2530d1791b
Fix several pylint errors and warnings
2018-06-23 00:54:22 -07:00
James R. Barlow
76e7e8dbbb
Replace several uses of str(path) with fspath(path)
...
Helps make it more explicit. Did not do this to tests because use of paths
is more involved there.
2018-06-22 21:00:47 -07:00
James R. Barlow
9e765ddf46
Rename _optimize to optimize.py
2018-06-22 17:51:57 -07:00