Skip to content

driftlgtm/conforma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conforma

conforma is a fast, parallel CLI image converter written in Rust.

It converts a single image file or a full directory tree into a target format, preserving relative folder structure in the output directory.

Convert an image or a whole directory tree to another format

Usage: conforma.exe [OPTIONS] --input <INPUT>

Options:
  -i, --input <INPUT>
          Input file or directory
  -o, --output <OUTPUT>
          Output root directory [default: conformed]
  -f, --format <FORMAT>
          Output image format [default: webp] [possible values: png, jpeg, webp, gif, tiff, bmp, ico, ppm, avif]
      --resize-percent <RESIZE_PERCENT>
          Resize all images to this percentage before writing output [default: 100]
      --resize-width <RESIZE_WIDTH>
          Resize output width in pixels. Can be used alone or with --resize-height
      --resize-height <RESIZE_HEIGHT>
          Resize output height in pixels. Can be used alone or with --resize-width
  -h, --help
          Print help
  -V, --version
          Print version

What It Does

  • Converts images from common formats (png, jpg, jpeg, webp, gif, tif, tiff, bmp, ico, ppm, pam, avif, heic, heif, dng, pcx)
  • Supports both file and directory input
  • Processes files in parallel using a thread pool
  • Resizes output by percentage via --resize-percent
  • Resizes output by target dimensions via --resize-width and/or --resize-height
  • Preserves input directory layout inside the output directory
  • Writes a JSONL cache log in the output directory (.conforma-log.jsonl) with each input file path, output format, resize percentage, and last-modified timestamp
  • Skips unchanged files only when last-modified timestamp and resize settings (resize_percent and/or pixel dimensions) match the cache
  • Recreates output files when reprocessing (existing output files are deleted before writing new ones)
  • Skips scanning the output folder if it is inside the input tree (to avoid recursive reprocessing)

Usage

conforma --input <PATH> [--output <DIR>] [--format <FORMAT>] [--resize-percent <PERCENT>] [--resize-width <PX>] [--resize-height <PX>]

Example:

.\conforma.exe --input "C:\Users\User\Downloads\cat pictures" --format webp

# Shrink output images to 60% while converting
.\conforma.exe --input "C:\Users\User\Pictures" --format jpeg --resize-percent 60

# Upscale images to 125%
.\conforma.exe --input "C:\Users\User\Pictures" --format png --resize-percent 125

# Set only width (height is calculated to preserve aspect ratio)
.\conforma.exe --input "C:\Users\User\Pictures" --format webp --resize-width 1200

# Set only height (width is calculated to preserve aspect ratio)
.\conforma.exe --input "C:\Users\User\Pictures" --format webp --resize-height 900

# Set both width and height explicitly
.\conforma.exe --input "C:\Users\User\Pictures" --format webp --resize-width 1200 --resize-height 900

Sample completion output:

Completed without errors in 30.55s (processed images: 17)

Sample cache log line:

{
    "input": "C:\\images\\photo.jpg",
    "format": "webp",
    "resize_percent": 80.0,
    "resize_width": 1200,
    "resize_height": null,
    "last_modified_ms": 1700000000000
}

Build

cargo build

Release build:

cargo build --release

Notes

  • --format avif may be significantly slower than webp, jpeg or png due to encoder complexity.
  • --resize-percent must be greater than 0.
  • When --resize-width or --resize-height is provided, pixel-based resizing is used.
  • This project was vibe-coded with GitHub Copilot.

About

Fast and parallel CLI image converter written in Rust.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages