Skip to content
programmersd21Public

pixl

native rust image processing, right in your terminal.
local processing · rgba8 · bounded decode · nine formats

original colour castle photo
original
same castle photo after pixl grayscale
after -grayscale

rust 2024 ci status msrv 1.88 runtime simd aur version mit or apache 2.0 sponsor pixl

install · features · commands · design · preview · development · license

source code · report an issue · releases


pixl turns images into whatever you need without sending them anywhere. give it a file, chain operations in order, and write the result in any supported format. it runs locally, uses one rgba8 buffer internally, and checks every dimension before allocating memory.

no account. no network. no telemetry. no daemon.

why pixl

  • private by design. everything runs on your machine. no cloud, no hosted service.
  • no GPU requirement. portable cpu builds with runtime simd detection.
  • built for terminal use. a small binary, ordered operations, predictable output.
  • useful output. nine formats, alpha-aware compositing, gradients and filters.
  • scriptable. errors go to stderr, exit codes are non-zero on failure.

sponsor

help keep pixl independent.
if pixl makes your workflow a little better, consider supporting its continued development.
your support helps make room for maintenance, testing, better documentation and thoughtful improvements.

sponsor pixl on GitHub

sponsorship is completely optional. using pixl, sharing it, reporting bugs and contributing code are just as appreciated.

install

cargo

requires rust 1.88 or later, plus the build prerequisites below.

cargo build --release -p pixl-cli

the installed executable is pixl, found at target/release/pixl.

aur

on arch linux, install the prebuilt binary package:

yay -S pixl-bin

or with paru:

paru -S pixl-bin

build prerequisites

requirement when it is needed
rust 1.88 or later building from source
cargo installing and running pixl
network access fetching crates on the first build

quick start

launch the tool on a file:

pixl input.png -resize 1920x1080 output.webp

or chain operations in order:

pixl input.png -grayscale -flip h output.qoi
pixl input.png -blur 0x8 output.png
pixl input.png -crop 800x600+0+0 output.png
pixl input.png -rotate 90 output.png

inspect and compare:

pixl identify input.png
pixl compare original.png modified.png

run pixl --help for every operation.

useful commands

pixl photo.png -resize 800x0 smaller.png
pixl photo.png -gamma 220 -contrast 30 output.png
pixl photo.png -composite overlay.png+10+10 output.png
pixl photo.png -append other.png+h output.png
pixl photo.png -gradient 800x400+#ff0000ff+#0000ffff output.png

command-line reference

operation value example
-resize wxh, use 0 to keep aspect -resize 800x0
-crop wxh+x+y -crop 800x600+0+0
-rotate 90, 180 or 270 -rotate 90
-flip h or v -flip v
-blur 0xsigma -blur 0x8
-sharpen sigmaxamount -sharpen 1x2
-grayscale none -grayscale
-brightness -255 to 255 -brightness 20
-contrast -255 to 255 -contrast 30
-gamma hundredths, 100 is 1.0 -gamma 220
-composite file+x+y -composite overlay.png+10+10
-append file+h or file+v -append other.png+h
-gradient wxh+color+color -gradient 800x400+#ff0000ff+#0000ffff

colours are eight hex digits: rrggbbaa.

features

capability details
nine formats png, jpeg, webp, bmp, gif, qoi, tga and pnm; ico decoding
geometry resize, crop, rotate, flip, append
colour grayscale, brightness, contrast, gamma, gradient
filtering gaussian blur, sharpen
compositing source-over alpha composite at an offset
inspection identify for dimensions, compare for channel deltas
safety dimension and pixel limits before allocation
simd runtime detection with portable scalar fallback
parallelism one global rayon pool, no nested pools

commands

command what it does
pixl <input> [ops] <output> apply operations in order and write the output
pixl identify <input>... show dimensions, format and byte count
pixl compare <first> <second> show differing bytes and the largest channel delta
pixl --help list all operations
pixl --version print the version

formats

format decode encode note
png yes yes rgba8 round trip tested
jpeg yes yes alpha composited onto white
webp yes yes through image
bmp yes yes rgba8 round trip tested
gif yes yes first frame only, static output
qoi yes yes through qoi
tga yes yes selected by file extension; no magic signature
pnm yes yes portable anymap; pnm and ppm extensions
ico yes no decode-only

how it works

flowchart TD
    A["input file"] --> B{"detect format"}
    B --> C["decode to rgba8"]
    C --> D["operations in order"]
    D --> E["encode to chosen format"]
    E --> F["output file"]
Loading

URL fetching is not used. transcription, processing and encoding all happen on your machine.

design

decoding always produces rgba8, so operations never branch on the source format. dimensions and pixel limits are checked before decoding; decoder allocation limits are also configured, though codec-level limits are not a complete sandbox. resize and blur filter premultiplied alpha to avoid transparent-edge colour fringes. resize uses precomputed coefficients with runtime cpu detection, and blur is a separable convolution.

crate role
crates/pixl-core image representation, pixel formats and limits
crates/pixl-codecs format detection, decode and encode
crates/pixl-ops operations and bounded parallelism
crates/pixl-cli parsing, ordered operations and diagnostics
why no color or cache crate?

colour conversion is a few functions in core and ops, and scratch buffers stay local to the operation that uses them. separate crates would add layers without solving a problem.

preview

every image below was produced from assets/original.png with the pixl binary. each caption shows the exact flag used.

source castle photo
source
castle resized to 256 by 256
-resize 256x256
castle cropped to a 256 by 256 region
-crop 256x256+128+128
castle rotated 90 degrees
-rotate 90
castle flipped horizontally
-flip h
castle converted to grayscale
-grayscale
castle with increased brightness
-brightness 40
castle with increased contrast
-contrast 60
castle with gamma correction
-gamma 150
castle with gaussian blur
-blur 0x3
castle sharpened with an unsharp mask
-sharpen 1x3
horizontal colour gradient
-gradient
gradient composited over the castle
-composite
castle and gradient appended side by side
-append
castle encoded as jpeg
.jpg output

development

cargo fmt --all -- --check
cargo check --workspace --all-targets --locked
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
cargo doc --workspace --no-deps
cargo bench -p pixl-ops

benchmarks print numbers measured on the machine that ran them. read contributing.md before opening a pull request.

ai disclosure

llms assisted with implementation and documentation. run the full check suite before treating this revision as release-ready. see ai_policy.md.

license

licensed under either of mit or apache 2.0, at your option.


built for people who like small, correct tools.

source code | report an issue | ai policy

Releases

Sponsor this project

Contributors

Languages