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
James R. Barlow
1a58abcc6a
concurrency: fix extra update of progressbar
2021-12-19 11:34:09 -08:00
James R. Barlow
dbfceba020
Standardize ghostscript version default
2021-12-18 02:01:42 -08:00
James R. Barlow
0faa618c3c
Replace deprecated distutils with packaging.version
2021-12-18 01:57:59 -08:00
James R. Barlow
7035002c03
Order of operations suppressed detailed Ghostscript missing error message
2021-12-18 01:27:39 -08:00
James R. Barlow
f8fadaef41
_windows: remove use of deprecated distutils
2021-12-13 20:45:54 -08:00
James R. Barlow
d48254d477
Fix issue with attempting to deskew a blank page on Tesseract 5
...
Closes #868
2021-12-10 21:48:09 -08:00
James R. Barlow
6910c48b81
Fix test_outputtype_none on Windows and cleanup docs
2021-12-06 15:38:38 -08:00
James R. Barlow
9de06f62ee
Use Python executors instead of pools
...
ProcessPool/ThreadPool don't have the ability to notice when a child worker
was terminated. ProcessPoolExecutor and ThreadPoolExecutor do notice and
provide better error messages.
Add tests to check.
2021-12-06 15:38:27 -08:00
James R. Barlow
26badf2882
typing: small improvements
2021-12-06 15:38:27 -08:00
James R. Barlow
8f873aaa45
sync: typing improvements
2021-12-06 15:38:27 -08:00
James R. Barlow
f91faf9795
Add new argument --tesseract-thresholding to control tesseract thresholding where available
...
Also add missing test for --tesseract-oem
2021-12-06 15:38:14 -08:00
James R. Barlow
cfe2bb25ba
Merge commit 'cd49e70154f82f54bf74fc5bb2586fe7e0358971' into release/v13
2021-11-15 00:33:34 -08:00
Tristan Porteries and GitHub
cd49e70154
ghostscript: force interpolation when rendering ( #855 )
...
Specifying option --oversample tends to introduce upsampling in rendering
by rasterizing page to an higher DPI.
This upsampling improves OCR results, but a correct choice of interpolation
method can increase even more the OCR quality.
Ghostscript seems to use a nearest interpolation as default choice for pdf.
This method doesn't average new introduced pixels with original pixels
resulting in an almost similar image but with more pixels.
Providing -dInterpolateControl=-1 force switching interpolation on.
In this commit the above option is passed to all ghostscript rendering
calls.
After testing, rendering a page at same DPI with interpolation
enabled does not introduce significant time overhead.
time (repeat 40 gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m \
-dFirstPage=1 -dLastPage=1 -r100.000000x100.000000 \
-dInterpolateControl=-1 -o /dev/null -dAutoRotatePages=/None -f pzII.pdf)
7,66s user 0,33s system 99% cpu 8,012 total
time (repeat 40 gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m \
-dFirstPage=1 -dLastPage=1 -r100.000000x100.000000 \
-o /dev/null -dAutoRotatePages=/None -f pzII.pdf)
7,42s user 0,39s system 99% cpu 7,808 total
Ghostscript interpolation control reference:
https://www.ghostscript.com/doc/current/Use.htm
2021-11-15 00:32:58 -08:00
James R. Barlow
7ce1692eef
windows: default version to '0' when looking for Ghostscript
...
To avoid ValueError: max() arg is an empty sequence
As suggested by @meet1919 in #833 .
2021-11-14 23:00:08 -08:00
James R. Barlow
4634b20de5
Raise max-image-mpixels again
...
PDFs are quite likely to have a lot of pixels, e.g. large high resolution scans.
250 MP is a page of A0 sized paper scanned at 400 DPI,
should be enough in most cases.
2021-11-14 15:47:39 -08:00
James R. Barlow
3810e576ff
optimize: fix mypy lint
2021-11-13 14:48:00 -08:00
James R. Barlow
01c7895044
pipeline: tidy
2021-11-13 14:47:49 -08:00
James R. Barlow
7b3d7ca92a
ghostscript: choco doesn't put Ghostscript on PATH anymore
...
It seems that chocolately doesn't put gswin[32,64]c on PATH anymore,
so compensate.
2021-11-13 01:18:12 -08:00
James R. Barlow
e3126d2806
Adjust test to support Tesseract 5 working harder to find its files
2021-11-13 01:16:35 -08:00
James R. Barlow
6f58a14351
pdfa: remove deprecated pkg_resources based access and tests
2021-11-13 00:52:03 -08:00
James R. Barlow
7ba04267b1
Remove shims to support for old versions of pikepdf < 4
2021-11-13 00:43:20 -08:00
James R. Barlow
698e8791d7
Remove Python 3.6 specific unicode environment checks
2021-11-13 00:28:52 -08:00
James R. Barlow
380b981763
Remove most Python 3.6 special casing
2021-11-13 00:27:48 -08:00
James R. Barlow
5abfb14c2a
Remove leptonica and cffi
2021-11-13 00:06:35 -08:00
James R. Barlow
59642a98b2
Disable --remove-background so we can remove leptonica
2021-11-12 23:56:52 -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
30440104ba
Remove --threshold argument
...
Tesseract is now included better thresholding (binarization) in v5. Users that have
thresholding issues should try that first. If we find further problems
this can be brought back as a plugin.
2021-11-12 20:09:55 -08:00
James R. Barlow
b159e02110
Convert deskew to use degrees, since all our other angles are in degrees
2021-11-12 16:40:51 -08:00
James R. Barlow
a55ab05d16
Replace leptonica deskew with tesseract find skew and pillow rotate
...
Also rebuild the cache.
2021-11-12 16:35:08 -08:00
James R. Barlow
25d046ae95
Modernize OrientationConfidence definition
2021-11-10 00:55:23 -08:00
James R. Barlow
01b0f76e36
Remove duplicate definition of OrientationConfidence
2021-11-10 00:55:07 -08:00
James R. Barlow
6c34d59836
tesseract: yet another version variant
2021-11-04 00:17:18 -07:00
James R. Barlow
386453d178
pdfa: replace read_binary() with files()
2021-10-31 02:01:11 -07:00
James R. Barlow
615a7561b5
tesseract: tidy some uses of str paths instead of Path
2021-10-31 02:01:05 -07:00
James R. Barlow
c4c64c3ea0
pre-commit updates
2021-10-31 01:31:57 -07:00
James R. Barlow
21279f5784
Fix leaked file handle for output_type none
2021-10-28 02:50:17 -07:00