mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-05 10:10:22 +00:00
Redaction wrote every cleared copy as Flate, so a redacted Group 4 or JBIG2 scan page grew several times over until the optimizer ran. A cleared one-bit image of one component is now stored as the smallest of Flate, CCITT Group 4 and, when it was JBIG2, JBIG2 (PDF 1.4, which such a file already is), as stored, dictionary included: a tiny image can lose by Group 4's parameters. Both are coded from the cleared samples, so nothing of the original's code is carried over; rows Group 4 or JBIG2 can't code (too wide) leave Flate. Images of more bits stay Flate. Tests: a cleared one-bit Flate scan of ragged word blocks (where Group 4 is smaller than Flate) comes out Group 4 and an eight-bit image Flate, each decoding to the cleared samples (the whole buffer); a tiny image whose Group 4 code is shorter but whose stream isn't, and rows wider than Group 4 codes, stay Flate and clear; the redacted JBIG2 scan of #5461's test comes out JBIG2, smaller than Flate, with no globals and no stream holding the original code. The tests' image helpers decode through Document::decoded_image, as image codecs need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
782 B
TOML
26 lines
782 B
TOML
[package]
|
|
name = "pdfcraft-redact"
|
|
description = "Redaction (architecture §11.2): marks, apply (glyphs, images, vectors, XObjects, annotations, fields), verification"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
pdfcraft-cos = { workspace = true }
|
|
pdfcraft-content = { workspace = true }
|
|
pdfcraft-fonts = { workspace = true }
|
|
pdfcraft-model = { workspace = true }
|
|
pdfcraft-forms = { workspace = true }
|
|
pdfcraft-edit = { workspace = true }
|
|
pdfcraft-annot = { workspace = true }
|
|
pdfcraft-xfa = { workspace = true }
|
|
# CCITT Group 4 and JBIG2 encoding for cleared one-bit images.
|
|
pdfcraft-filters = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
|
|
[dev-dependencies]
|
|
pdfcraft-testkit = { workspace = true }
|