make-look-scanned: Transforming PDFs into Realistic Scanned Documents
Overview
make-look-scanned is a technical utility designed to make digital PDFs appear as if they were physically printed and then scanned back into a computer. It achieves this by rasterizing each page into an image and applying a pipeline of degradation effects, including skew, grayscale, noise, and JPEG artifacts. The final output is an image-only PDF, meaning all original selectable text is removed, mirroring the behavior of a basic flatbed scanner.
Core Degradation Pipeline
The tool simulates the physical imperfections of scanning through several adjustable parameters. Each numeric setting can be disabled by setting it to 0.
Visual Effects
- Skew: Introduces a maximum rotation in degrees to simulate misaligned paper.
- Grayscale: Desaturates the document to remove color.
- Paper Tone: Adds a warm tint to simulate the aging or quality of physical paper.
- Noise: Adds scanner grain to the image.
- Blur: Applies a Gaussian sigma defocus to simulate lens or sensor blur.
- Edge Shadow: Creates a border vignette to simulate the shadow cast by the scanner lid or paper edges.
- JPEG Quality: Introduces compression artifacts by adjusting the JPEG quality level (1-100).
Technical Specifications
- Resolution: The default render resolution is 150 DPI.
- Determinism: The tool is deterministic by default. The random seed is derived from the input PDF's content hash, ensuring that the same file always produces the same visual result. Users can override this with the
--seedflag for a different but reproducible look. - Presets: Users can define reusable configuration bundles in a
config.tomlfile (located in$XDG_CONFIG_HOME/make-look-scanned/or~/.make-look-scanned/), allowing for quick application of specific "looks" via the--presetflag.
Deployment and Implementation
make-look-scanned is implemented in Go and provides two primary ways to be used:
Command Line Interface (CLI)
The CLI version requires Go and a C toolchain. It utilizes go-fitz to link to MuPDF, creating a self-contained binary that does not require runtime installations.
Browser-based (WebAssembly)
To ensure privacy and avoid the need to upload sensitive documents to third-party servers, the tool offers a WASM implementation. Because MuPDF cannot be compiled to WASM, the browser version uses PDF.js for rasterization and then passes the resulting pixels to the same Go effects pipeline compiled to WASM. This allows the tool to run entirely client-side.
Community Insights and Alternatives
Discussion around the tool highlights both its practical utility and the limitations of digital simulation.
Privacy and Utility
The author created the tool specifically to avoid "sketchy" online tools that require file uploads. Community members have noted the value of having a free, open-source alternative to paywalled PDF utilities.
Technical Feedback
Some users suggested improvements to increase realism, such as adding random blank pages or allowing direct image output (JPG/PNG) instead of wrapping the result back into a PDF. One user noted that the "edge gradient bevels" can sometimes give away the digital nature of the effect:
In the example image, the edge gradient bevels give it away.
Alternative Methods
Users shared various manual and automated alternatives for achieving similar results:
- ImageMagick: A complex command string using
-rotate,+noise Gaussian, and-blurcan replicate the effect. - Physical Method: Taking a photo of a PDF displayed on a monitor using a smartphone scanner app.
- Specialized Tools: Tools like
falsisignare mentioned for adding signatures and applying a scanned look to documents.
Licensing
The CLI version is licensed under AGPL-3.0 because it statically links MuPDF. The browser build, which uses PDF.js (Apache-2.0), does not include MuPDF.