Skip to content

Getting started

This tutorial walks you through setting up the environment and running a complete image format comparison — from dataset download to interactive report.

  1. Clone the repository:

    Terminal window
    git clone https://github.com/kadykov/web-image-formats-research.git
    cd web-image-formats-research
  2. Open in VS Code and start the dev container:

    Terminal window
    code .

    VS Code will detect the .devcontainer/ configuration and prompt you to “Reopen in Container”. Click it. The first build takes several minutes because it compiles image encoding tools from source.

  3. Verify the setup:

    Terminal window
    just verify-tools

    You should see checkmarks for all encoding tools (cjpeg, cwebp, avifenc, cjxl) and quality measurement tools (ssimulacra2, butteraugli_main, ffmpeg).

  4. Run the quality checks:

    Terminal window
    just check

    This runs formatting checks, linting, type checking, and all tests. Everything should pass in a fresh dev container.

Studies need source images. Fetch the DIV2K validation dataset (100 images, ~450 MB):

Terminal window
just fetch div2k-valid

For higher resolution research, you can also fetch 4K datasets (see Fetch Datasets for all options).

Run the format comparison study, which encodes each image as JPEG, WebP, AVIF, and JPEG XL and measures quality metrics. Give it a 30-minute time budget:

Terminal window
just pipeline format-comparison 30m

The pipeline will:

  1. Pick images from the dataset one at a time
  2. Encode each image in all configured formats and quality levels
  3. Measure SSIMULACRA2, PSNR, SSIM, and Butteraugli for every encoded variant
  4. Save results to data/metrics/format-comparison/quality.json
  5. Repeat until the 30-minute budget runs out

Generate statistical summaries and static plots:

Terminal window
just analyze format-comparison

This creates CSV statistics and SVG plots in data/analysis/format-comparison/.

Generate side-by-side comparison images showing the worst-case encoding regions with Butteraugli distortion maps:

Terminal window
just compare format-comparison

Combine everything into an interactive HTML report with Plotly visualizations:

Terminal window
just report

Preview it locally:

Terminal window
just serve-report

Open http://localhost:8000 in your browser to explore rate-distortion curves, quality-vs-parameter plots, and comparison images.