James R. Barlow
bc745d4d81
Replace magic Ghostscript raster device strings with StrEnum
2026-01-20 10:44:25 -08:00
James R. Barlow
16c2604a07
Remove lossy JBIG2 support, retain lossless JBIG2 only
...
Lossy JBIG2 has been removed due to well-documented risks of character
substitution errors (e.g., 6/8 confusion). The --jbig2-lossy and
--jbig2-page-group-size arguments are now deprecated and ignored with
a warning.
Changes:
- Remove jbig2_lossy and jbig2_page_group_size from OCROptions
- Simplify optimize.py to use single-image JBIG2 encoding only
(no symbol dictionaries/JBIG2Globals)
- Remove convert_group() from jbig2enc.py
- Deprecate CLI args with warnings for backward compatibility
- Update documentation to explain lossless-only JBIG2
2025-12-23 02:45:07 -08:00
James R. Barlow
3beabf55e7
Skip optimizing images with pre-blended soft masks
...
Fixes issue [Bug]: Optimized pdf not rendering with Quartz / Core Graphics #1536
2025-06-12 23:58:43 -07:00
James R. Barlow
42ff7fc842
Fix handling of pages that are restored to correct orientation with /Rotate
...
Appears inversion of CTM was incorrect, introduced in commit 9898904
2024-02-12 01:32:26 -08:00
James R. Barlow
dfa4ebf1a6
Simplify function signature of extract_image_filter
2023-10-24 00:54:31 -07:00
James R. Barlow
58f388c69d
optimize: better coverage
2023-10-24 00:54:31 -07:00
James R. Barlow
ac2fc49208
Add support for adjusting jbig2 threshold
2023-09-17 14:44:40 -07:00
James R. Barlow
070c9772ce
Add test to confirm we can find formx optimizable images
2023-05-23 00:33:54 -07:00
James R. Barlow
b2e6a6431e
Tidy use of pikepdf.open without with
2023-04-15 20:17:44 -07:00
James R. Barlow
7da4e6ca7f
Address some linter warnings
2022-09-21 00:05:12 -07:00
James R. Barlow
f4155dca77
tests: convert all uses of multipage.pdf to fixture
2022-08-11 01:13:10 -07:00
James R. Barlow
80ed2117cc
Change to SPDX license tracking
2022-07-28 01:10:07 -07:00
James R. Barlow
dc6f1a266a
Modernize type annotations
2022-07-23 00:39:24 -07:00
James R. Barlow
514038d4ec
optimize: recognize and produce [/FlateDecode /DCTDecode] images
2022-02-08 00:38:08 -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
c75ff4687a
Turning on Ghostscript interpolation changes this test
...
Seems acceptable. We don't normally use Ghostscript to downsample PDFs
like is happening in this test.
2021-11-15 16:36:24 -08:00
James R. Barlow
173a80864d
Delinting
2021-04-07 02:09:45 -07:00
James R. Barlow
aa115a8be3
Remove pytest_helpers_namespace
2021-04-07 01:56:51 -07:00
James R. Barlow
ec1d585d40
Merge branch 'feature/misc-breaking'
2021-04-01 16:51:04 -07:00
James R. Barlow
0a42934c08
Exclude Group 3 images from optimization
2021-03-20 23:28:21 -07:00
James R. Barlow
bccf2f423f
Stricter parameter checking for many public functions
2021-01-31 19:27:25 -08:00
James R. Barlow
1a982da442
tests: confirm that we produce pdf when optimization is off
2021-01-24 01:54:25 -08:00
James R. Barlow
bd0f005861
tests: tag tests that need pngquant, jbig2enc
2020-12-30 01:58:57 -08:00
James R. Barlow
babc76fa74
tests: assert that most patched functions are called
...
We were not actually checking if functions we patched we called when
expected.
2020-12-28 23:58:33 -08: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
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
1598f2f0e5
Abolish spoof_tesseract_noop
2020-06-01 03:07:53 -07:00
James R. Barlow
c85278b31d
Delinting
2020-05-03 00:53:29 -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
94c52a6fa3
Refactor 'xyres' into Resolution
2020-04-24 04:12:05 -07:00
James R. Barlow
57771f06a3
Refactor xy-pair for resolution to tuple
2020-04-16 15:38:33 -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
c5edff2c2f
Sort imports
2019-12-19 15:31:18 -08:00
James R. Barlow
feff1e38bb
Use context managers to ensure Pillow images are closed
2019-09-03 17:19:12 -07:00
James R. Barlow
b0d9775343
Attempt to resolve black-inversion issue
2019-08-31 01:25:36 -07:00
James R. Barlow
793348a47c
tests: mark test as requiring pngquant
2019-08-11 16:58:22 -07:00
James R. Barlow
df32008667
Ensure test_optimize passes
...
Linearization sends it over the edge
2019-07-27 16:47:53 -07: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
7d330afd81
Delinting
2019-01-02 13:34:45 -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
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
9a8ec4b210
optimize: only enable lossy JBIG2 for -O3
2018-10-03 00:38:58 -07:00
James R. Barlow
85f96b7fb0
Add test to optimize if jbig2 is present
2018-07-02 23:49:11 -07:00
James R. Barlow
e725f64b6a
Add test case to ensure mono is not inverted
2018-06-29 00:25:11 -07:00
James R. Barlow
b0dbaeafc5
Cleanup unused imports
2018-06-23 01:47:53 -07:00
James R. Barlow
9e765ddf46
Rename _optimize to optimize.py
2018-06-22 17:51:57 -07:00