fakejpeg-cli

Crates.iofakejpeg-cli
lib.rsfakejpeg-cli
version0.1.1
created_at2025-08-08 15:22:33.01056+00
updated_at2025-09-05 08:01:44.373519+00
descriptionCLI tool to generate fake JPEGs
homepage
repositoryhttps://git.madhouse-project.org/iocaine/fakejpeg-rs
max_upload_size
id1786893
size36,153
Gergely Nagy (algernon)

documentation

README

fakejpeg-rs

Build status Docs Crates.io release

What?

This is a port of Alun Jones' fakejpeg Python library to Rust, and shares many of the original's goals: a library to generate structurally valid JPEG files, cheaply, based on a set of templates learned from real JPEG files. The generated image will contain random bytes, but because the structure is valid JPEG, most decoders will reluctantly deal with them anyway.

Why?

As the original, the Rust port was done for the same reason: as part of a defense mechanism against AI scrapers: iocaine. To serve unwanted visitors an endless supply of images on demand, with little cost to the server.

How?

Magicâ„¢. No, really, it is magic, see the explanation in the original!

Goals

The ultimate goal here is to parse legit JPEG files reasonably efficiently (but parsing speed and efficiency is secondary) and correctly, collect the minimum amount of information needed to generate fakes from, and then generate structurally valid fakes with random data, fast. Correctness beyond valid structure are not a concern.

The idea is that we'd build templates from legit JPEG files, and then continue generating fakes from these. The templates should be kept as long as possible - including saving them to disk -, because processing a large set of JPEGs is comparatively expensive. Even if it only takes a minute or two, loading saved data only takes a couple of milliseconds. So train once, generate garbage forever!

Commit count: 0

cargo fmt