Skip to main content

Crate codec_corpus

Crate codec_corpus 

Source
Expand description

§codec-corpus

Runtime API for downloading, caching, and accessing test image datasets from the imazen/codec-corpus GitHub repository and third-party sources.

No data ships with the crate. Datasets are fetched lazily on first access and cached locally.

§imazen/codec-corpus (default)

let corpus = codec_corpus::Corpus::new().unwrap();
let valid = corpus.get("webp-conformance/valid").unwrap();

§Third-party sources (built-in registry)

let corpus = codec_corpus::Corpus::new().unwrap();

// OSS-Fuzz backup corpora (ZIP download)
let ossfuzz_jpeg = corpus.get("oss-fuzz/libjpeg-turbo").unwrap();
let ossfuzz_png = corpus.get("oss-fuzz/libpng").unwrap();
let ossfuzz_jxl = corpus.get("oss-fuzz/libjxl").unwrap();

// dvyukov/go-fuzz-corpus subfolders
let gofuzz_gif = corpus.get("go-fuzz-corpus/gif").unwrap();

// libjpeg-turbo fuzz seed corpus
let ljt = corpus.get("libjpeg-turbo-fuzz").unwrap();

// image-rs/image test images
let imagers = corpus.get("image-rs/tests/images").unwrap();

§Ad-hoc sources

let corpus = codec_corpus::Corpus::new().unwrap();

// Arbitrary GitHub repo subfolder
let path = corpus.github_repo("niclas-aspect/jxl-rs", "test-data", "main").unwrap();

// Arbitrary ZIP URL
let path = corpus.zip_url("my-corpus", "https://example.com/corpus.zip").unwrap();

// Arbitrary tarball URL
let path = corpus.tar_url("my-tarball", "https://example.com/corpus.tar.gz").unwrap();

// Local directory (validates existence, no download)
let path = corpus.local_path("/home/user/my-images").unwrap();

Structs§

Corpus
Handle for accessing cached test-image datasets.

Enums§

Error
Errors that can occur when using the corpus.