-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.jsonc
More file actions
163 lines (137 loc) · 7.27 KB
/
Copy pathsettings.jsonc
File metadata and controls
163 lines (137 loc) · 7.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
// ===== Paths =====
// Directory containing the jbig2enc binary (bundled in deps/jbig2enc).
"native.dir": "./deps/jbig2enc",
// ===== PDF Rendering =====
// DPI for rendering PDF pages to images before compression.
// 300 = standard quality
// 200 = faster, smaller output
// 600 = high resolution (≈4x the memory of 300; raise the JVM heap and/or
// lower pipeline.maxThreads to avoid running out of memory)
"rendering.dpi": 300,
// ===== Image Segmentation =====
// Tile size (px) for background normalization grid.
// Smaller = more detail; larger = faster.
"segmenter.tileSize": 64,
// Background-level percentile per tile (0.0 - 1.0).
// 0.95 = 95th percentile. Increase for sparse text.
"segmenter.percentile": 0.95,
// Inpainting propagation radius (px) for filling text regions.
// <= 0 = infinite (propagate to every foreground pixel; no white blobs).
// > 0 = bounded (pixels farther away are filled white).
"segmenter.inpaintRadius": 0,
// Thresholding mode: "sauvola" or "otsu".
// sauvola (default): per-pixel local adaptive threshold from the mean/stddev
// of a small window (sauvolaWindow/K/R). Use for scanned or photographed
// pages with uneven illumination, shadows, gradients, or faint/low-contrast
// text — it keeps thin strokes that a single global threshold would miss.
// otsu: one global threshold over the whole normalized page. Faster, and good
// for clean, uniformly lit, high-contrast pages (printed text on white);
// it tends to drop faint text or over-segment busy backgrounds.
// When in doubt, start with sauvola; try otsu if sauvola captures too much
// background noise (speckle) on otherwise clean pages.
"segmenter.thresholdMode": "sauvola",
// Sauvola local window side (px). Integral images keep this cheap.
"segmenter.sauvolaWindow": 15,
// Sauvola sensitivity (0.1 - 0.5). Higher = more aggressive foreground.
"segmenter.sauvolaK": 0.20,
// Sauvola dynamic range of the image (typical 128 for 8-bit gray).
"segmenter.sauvolaR": 128,
// Connected-component filtering: dark regions larger than these limits are
// treated as pictures/logos and left in the (color) background instead of
// the JBIG2 mask. Fractions of page area / larger page dimension. 0 disables.
"segmenter.maxComponentArea": 0.005,
"segmenter.maxComponentDim": 0.10,
// ===== Pipeline =====
// Maximum worker threads for page preparation (rendering is always
// sequential; segmentation + text extraction + image IO run in parallel).
// 0 = auto (use all available processors). Override via --threads.
// The pipeline keeps up to (threads + 2) pages in memory at once; at high
// DPI (e.g. 600) each page needs ~1 GB, so cap this and raise the JVM heap.
"pipeline.maxThreads": 0,
// ===== MRC =====
// Enable Mixed Raster Content compression.
// true = segment background (JPEG) + foreground (JBIG2) + text layer
// false = original images (JPEG) + text layer only (no MRC compression)
"pipeline.mrc.enabled": true,
// Background downscale factor for MRC (0.1 - 1.0).
// 0.33 = 3x downsampling (e.g., 300 DPI → ~100 DPI background)
// 1.0 = no downsampling (full resolution)
// Text sharpness is preserved by the foreground mask layer.
// Override via --bg-scale CLI flag.
"pipeline.mrc.backgroundScale": 0.33,
// Background JPEG quality when a foreground mask is present (0.1 - 1.0).
// 0.50 = default (text pixels come from the sharp mask, not the JPEG)
// 0.90 = higher quality background, larger file
// Override via --jpeg-quality CLI flag.
"pipeline.mrc.jpegQuality": 0.50,
// Background JPEG quality when MRC is OFF (no foreground mask, so the
// background is the only visual layer). 0.1 - 1.0.
// 0.85 = default (good fidelity for full-resolution page images)
// 1.0 = near-lossless, larger file
// Ignored when "pipeline.mrc.enabled" is true. Override via --jpeg-quality.
"pipeline.jpegQuality": 0.85,
// Pre-encode Gaussian blur sigma for MRC background (0 = off).
// 0.8 = mild smoothing (reduces JPEG artifacts, improves compression)
// 0 = no smoothing
// Safe because text edges come from the mask, not the background.
"pipeline.mrc.bgSmoothSigma": 0.8,
// True MRC foreground color plane: the binary mask becomes a soft mask
// (SMask) over a downsampled copy of the original page, so text pixels keep
// their original color instead of flat black.
// false = black stencil (default, smaller, PDF/A compatible)
// true = color text (soft masks are NOT allowed in PDF/A-2b)
// Override via --fg-color CLI flag.
"pipeline.mrc.foregroundColor": false,
// Downsample factor for the foreground color plane (0.1 - 1.0).
// 0.5 = 2x downsampling (default; good balance of size and color fidelity)
// 0.25 = 4x downsampling (smaller, but thin dark strokes may wash out)
// 1.0 = full resolution (largest file, best fidelity)
// The full-res binary mask keeps text edges sharp regardless of this factor.
"pipeline.mrc.foregroundScale": 0.5,
// JPEG quality for the foreground color plane (0.1 - 1.0).
"pipeline.mrc.foregroundJpegQuality": 0.7,
// ===== JBIG2 Compression =====
// Flags passed to the jbig2enc binary.
// -p = global symbol dictionary
// -s = refine smearing
"jbig2enc.flags": "-p -s",
// ===== PDF/A =====
// Enable PDF/A-2b output (adds XMP metadata, sRGB OutputIntent).
// Override via --pdfa CLI flag.
"pdf.pdfa.enabled": false,
// Path to a TrueType font file for embedding into PDF/A output.
// Required for strict PDF/A compliance (Standard 14 fonts are not embedded).
// When empty, falls back to Standard 14 fonts (non-embedded).
"pdf.pdfa.fontPath": "",
// ===== PDF Assembly =====
// Path to a TrueType/OpenType font for the invisible text layer.
// Required for CJK characters (Chinese, Japanese, Korean).
// When empty, auto-detects the bundled font (deps/fonts) or a system
// CJK font if the extracted text contains CJK characters.
"pdf.fontPath": "",
// Standard 14 font for the invisible text layer (Latin-only).
// The Standard 14 are Type1 fonts guaranteed in every PDF viewer
// (defined by the PDF spec), so they never need embedding, keeping
// the output file small.
//
// Family | Variants
// ---------------+--------------------------
// Times-Roman | Regular, Bold, Italic, BoldItalic
// Helvetica | Regular, Bold, Italic, BoldItalic
// Courier | Regular, Bold, Italic, BoldItalic
// Symbol | Regular
// ZapfDingbats | Regular
//
"pdf.font": "HELVETICA",
// Minimum font size (pt) to prevent zero-size fonts.
"pdf.minFontSize": 1,
// Producer string for the output PDF metadata.
// If the input PDF has a Producer, the output will be "<input> -> <producer>".
// If the input has no Producer, the output will be the string below.
"pdf.producer": "MrcPdf",
// ===== Output =====
// Default output PDF path.
// Override via -o / --output CLI flag.
"output.file": "output.pdf"
}