Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.

noClaps/imgoptim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imgoptim

A command line utility to optimise images.

Build instructions

You'll need Rust.

cargo install --git https://github.com/noClaps/imgoptim

Usage

A command line utility to optimise images

Usage: imgoptim <COMMAND>

Commands:
  optimise  Optimise HEIC images to AVIF
  height    Get the height of an AVIF image
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

You can view the help for the command using --help or -h:

imgoptim --help
imgoptim -h

Optimise

Optimise HEIC images to AVIF

Usage: imgoptim optimise [OPTIONS] <PATH> <OUT_PATH>

Arguments:
  <PATH>      Path to the image you'd like to optimise
  <OUT_PATH>  Output path for the optimised image

Options:
  -W, --width <WIDTH>  Set the width of the output image in pixels
  -h, --help           Print help

You need to pass in a path to a HEIC image, and an output path:

imgoptim optimise path/to/image.heic path/to/image.avif

This will optimise your input HEIC image to an AVIF image, retaining the same dimensions. If you'd like to customise the width of the image, you can do so with the --width or -W option:

imgoptim optimise path/to/image.png path/to/image.avif --width 800 # pixels
imgoptim optimise path/to/image.png path/to/image.avif -W 800 # pixels

This will retain the aspect ratio of the input image, but will resize it to be the width you've set.

imgoptim optimise image.png image.avif # 4032x3024
imgoptim optimise image.png image.avif --width 800 # 800x600

You can view the help for the command using --help or -h:

imgoptim optimise --help
imgoptim optimise -h

Height

Get the height of an AVIF image

Usage: imgoptim height <PATH>

Arguments:
  <PATH>  Path to the image to get the height of

Options:
  -h, --help  Print help

You can get the height of a given AVIF image using the imgoptim height command.

imgoptim height path/to/image.avif # 600

You can view the help for the command using --help or -h:

imgoptim height --help
imgoptim height -h

About

A command line utility to optimise images

Resources

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages