Imaging library. Provides basic image processing and encoders/decoders for common image formats.
open sourceMIT OR Apache-2.0self-hostablefree
The image crate decodes, encodes and processes images in pure Rust. Its default formats are AVIF, BMP, DDS, EXR, Farbfeld, GIF, HDR, ICO, JPEG, PNG, PNM, QOI, TGA, TIFF and WebP, each behind a Cargo feature, and it has basic operations (resizing, cropping, colour conversion) on its ImageBuffer types. ImageReader guesses a file's format from its bytes and takes decoding limits, so an untrusted file can't claim enormous dimensions and take the memory.
Problems it solves
- decode PNG and JPEG files in Rust without linking a C library
- check whether an uploaded file is really an image and read its width and height
- find out what format a file is from its bytes rather than its extension
- resize and crop images in a Rust backend
- convert images between PNG, JPEG and WebP in Rust
- read the largest icon out of a favicon.ico file
- decode untrusted images with a memory limit so a crafted file can't exhaust RAM
- generate thumbnails in Rust
- encode a pixel buffer I drew as a PNG
Features
- decoders and encoders for AVIF, BMP, GIF, ICO, JPEG, PNG, TIFF, WebP and more
- format detection from bytes
- decoding limits
- resize, crop and colour conversion
- one Cargo feature per format
Capabilities
| Takes plugins | plan not known |
|---|---|
| Has official SDKs | plan not known |
Alternatives
The same job
These do what image does.
- ImageMagick The open-source suite for image creation, conversion, and batch manipulation
- resvg An SVG rendering library
