Scan Offsets of Scans
Progressive JPEG parser for HTTP/2 parallel progressive streaming feature.
It scans a JPEG file looking for Start Of Scan markers. Computes optimal offsets for the cf-priority-change header to render "DC-only" and "good enough" progressive stages.
Building and usage
Install Rust 1.48 or later, and run:
You can also build for WASM with rustup target add wasm32-unknown-unknown; cargo build --release --target=wasm32-unknown-unknown or use wasm-pack.
This tool requires progressive JPEG files, and doesn't do anything for baseline JPEG or other formats.
This will print to stdout Cloudflare's cf-priority (first line) and cf-priority-change (second line) headers with breakpoints for the image.jpg file, an error to stderr. The image is read from stdin if not path is specified.
The same can be done programmatically by using this crate as a library and calling soos::Scans::from_file(jpeg_bytes)?.cf_priority_change_headers()?.
Example tools
These tools show debug information used to generate the HTTP priority headers.