Discover how to convert PDFs to scanned document style with a powerful CLI tool that runs in your browser too.
In an age where digital documentation is ubiquitous, the aesthetic of a well-worn, scanned printout still holds significant appeal for various purposes. Whether aimed at enhancing authenticity in archival projects, achieving specific artistic effects, or giving a genuine feel to documents, the conversion of PDFs to appear scanned is now possible with an innovative command line interface (CLI) tool. This tool also runs in the browser through WebAssembly (WASM), making it highly versatile.
The open-source tool, dubbed make-look-scanned, offers a simple yet powerful way to transform clean PDF files into images that mimic the imperfections of physical scans. Users can apply features such as skewing, grayscale tones, warm paper shades, scanner noise, defocusing effects, edge shadows, and JPEG compression artifacts to achieve an authentic scanned look.
This combination of features means that the final output accurately reproduces the nuances one expects from a real-world scanner. The tool does this by rasterizing each page into an image, applying adjustments according to user-defined parameters, and then reassembling these images into a new image-only PDF format that discards the original text.
Installation is straightforward for those familiar with Go and C toolchains. The tool requires a Go technology/">environment for building and running the CLI. To build, users execute the command go build -o make-look-scanned ..
Once set up, the basic usage is as simple as:
make-look-scanned in.pdf creates in.scanned.pdf.
Users can customize their output further using several flags:
For example, if a user wants to define a specific output path or change parameters, they can do:
make-look-scanned in.pdf -o out.pdf --noise 0.4 --skew 2.5 --jpeg-quality 30
The tool comes with a range of flags that allow users to control various aspects of the appearance and quality of the output PDF. Some of the key options include:
- -o: Specifies the output file name.
- --preset: Allows users to apply predefined settings from a configuration file.
- --seed: Determines the randomness of the effects applied, allowing for reproducible variations with the same input.
- --dpi: Controls the rendering resolution to suit user needs.
- --skew: Adjusts the tilt of the output image simulating a physical scan.
- --grayscale: Toggles between a grayscale output and full color.
- --paper-tone: Modifies the strength of the warm paper tint.
- --noise: Controls the graininess that mimics the effects of using a low-quality scanner.
By combining these flags, users can fine-tune the scanned appearance of their documents to achieve the desired effect.
One of the most compelling features of make-look-scanned is its capability to run directly in a browser via WebAssembly. This frontend usage opens the door for users who may not be aware of or don't have access to command line interfaces.
Internally, the browser-based version utilizes PDF.js for rasterization, meaning the document is processed entirely in the user's web environment. Notably, while both the CLI and the browser version can create similar visual outputs, they may differ in byte-identity due to the underlying rasterization processes of the two libraries, PDF.js and MuPDF.
To create the web version, users can build it with the task build:web command. The output file will be an HTML document that contains the inline WebAssembly, along with Go's runtime glue and PDF.js resources encoded in base64.
To enhance the user experience further, the tool allows the definition of reusable bundles through a configuration file config.toml. Users can set default values and presets, enabling quick access to commonly used settings.
The configuration file should be placed in the $XDG_CONFIG_HOME/make-look-scanned directory, falling back to the ~/.make-look-scanned/config.toml if necessary.
Keys in this configuration file mirror the flag names, streamlining the process of customizing effects for future use.
make-look-scanned operates under the AGPL-3.0 license. When using it, particularly for distribution, the complete source code must be provided, ensuring anthropic-implications-for-ai-models/">compliance with open-source obligations.
It is noteworthy that the CLI tool employs MuPDF through the go-fitz bridge. This could be a consideration for developers planning integrations or distributions since the binary must adhere to AGPL restrictions. Conversely, the browser builds utilize PDF.js, which operates under the Apache-2.0 license, granting more flexibility in certain applications.
The innovation represented by tools like make-look-scanned showcases the continuous evolution of document handling and processing technologies. The ability to easily convert PDFs into customized scanned appearances will have significant implications for workflows in academia, creative industries, and archival work.
Furthermore, as the tool continues to develop, we can expect enhancements in processing speed, versatility, and image quality, making the future of document aesthetics even more promising.
make-look-scanned is a CLI tool that converts PDF documents into styles that resemble scanned images, applying various customizable visual effects.
Yes, make-look-scanned can be executed in a browser using WebAssembly, allowing users to perform the same transformations without command-line knowledge.
The tool is available under the AGPL-3.0 license for the CLI version and utilizes PDF.js under the Apache-2.0 license for the browser version.