3 releases
Uses new Rust 2024
| new 0.0.3 | Nov 8, 2025 |
|---|---|
| 0.0.2 | Sep 13, 2025 |
| 0.0.1 | Aug 26, 2025 |
#232 in Images
14KB
260 lines
reimg
A simple CLI tool for web image resizing, using image-rs.
Installation
cargo install reimg
You can also download the prebuilt binary from the release page
Usage
reimg uses stdin/stdout to read and write image data.
reimg -w 512 -h 512 --cover -f avif < input.jpg > output.avif
You can use reimg as a sub-command in your app. For example, resize and transform images in Bun:
import { $ } from "bun"
const out = await $`reimg -w ${512} -h ${512} --cover -f avif < ${Bun.file("input.jpg")}`.quiet()
const res = new Response(out.arrayBuffer(), {
headers: {
"Content-Type": "image/avif"
}
})
Options
$ reimg
Usage: reimg [OPTIONS] < input_image_file > output_image_file
Options:
-w, --width <width> Set the width of the output image
-h, --height <height> Set the height of the output image
--fit <fit> Set the fit mode for the resize operation [possible values: cover, contain, scale-down]
--cover Resize the image to fill the given dimensions, cropping if necessary
--contain Resize the image to fit the given dimensions
--scale-down Resize the image to fit the given dimensions, but not larger than the original
-q, --quality <quality> Set the quality of the output image [default: 85]
-f, --format <format> Set the format of the output image [possible values: jpeg, png, webp, avif, ico]
-i, --info Show image metadata
License
MIT
Dependencies
~30MB
~636K SLoC