1. The Problem with Naive Inversion
In traditional image processing, color inversion simply subtracts each RGB channel from 255 (r' = 255 - r). While this works well for black text on white paper, it produces disastrous results on real-world documents:
- Color photographs invert into eerie, unrecognizable photographic negatives.
- Data charts with meaningful color keys (such as red/green status indicators) invert into opposing, misleading hues.
- Small marks and fine type can lose clarity when a page is rendered at insufficient resolution.
2. Dual-Channel Separation: Chroma vs. Luminance
To solve this without uploading documents to costly AI vision servers, InvertPDFNow runs a lightweight, deterministic algorithm directly on pixel buffers:
For every pixel, we calculate relative luminance L = 0.299R + 0.587G + 0.114B and chroma saturation C = max(R,G,B) - min(R,G,B).
Pixels with chroma above 28 are treated as colorful pixels and left unchanged when Auto-protect photos is selected. This is a simple pixel heuristic—not object detection—so it can preserve colors in charts and photos but can also misclassify muted images. The preview is the source of truth.
3. Local Assembly and Integrity Verification
Unlike tools that blindly write output streams, InvertPDFNow includes an automated pre-download verification step:
- The newly assembled PDF binary is re-opened in memory using PDF.js.
- The generated page count is compared with the number of pages selected for conversion.
- The first exported page is test-rendered in an off-screen canvas to confirm the generated file can be parsed and rendered.
4. Honest Disclosures & Limitations
We believe in complete transparency about what client-side PDF transformation can and cannot preserve:
Digitally Signed PDFs: Any modification to a cryptographically signed document invalidates the digital signature. Our tool will process the visual appearance, but the output must be treated as a new unsigned copy.
Interactive XFA Forms: Dynamic Adobe LiveCycle XFA forms cannot be re-encoded by client-side canvas engines; their visual fields will be flattened.
Text, Links, and Annotations: The current export is image-based. Searchable text, links, form behavior, bookmarks, and annotations are not retained. A future vector path is described in the implementation plan but is not presented as a shipped feature.