explaingit

image-rs/image

5,745RustAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

Rust library for reading, writing, and processing image files. Supports PNG, JPEG, WebP, GIF, AVIF, and more out of the box, plus resizing, cropping, rotation, blur, and color adjustments.

Mindmap

mindmap
  root((image-rs))
    Formats
      PNG JPEG GIF
      WebP TIFF BMP
      ICO AVIF
    Operations
      Resize crop
      Rotate flip
      Blur grayscale
      Brightness contrast
    Core Types
      DynamicImage
      ImageBuffer
      Pixel formats
    Use Cases
      File conversion
      Thumbnail generation
      Photo processing
      Web service images
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Open an image file in a Rust program, resize it to new dimensions, and save it in a different format such as converting PNG to JPEG.

USE CASE 2

Build a batch thumbnail generator that reads any common image format and outputs a small preview file.

USE CASE 3

Apply image processing operations like blur, grayscale, or brightness adjustment to user-uploaded photos in a web service.

USE CASE 4

Build a Rust program that converts a folder of images between formats without writing any file-format parsing code.

Tech stack

Rust

Getting it running

Difficulty · easy Time to first run · 30min

Some formats require enabling specific feature flags in Cargo.toml, debug builds run slowly so use release mode for performance work.

Use freely in personal or commercial Rust projects.

In plain English

This is a Rust library for reading and writing image files. If you are building a program in Rust that needs to open a photo, modify it, and save it back out, this library handles the file format details so you do not have to. It can read and write a wide range of common image formats: PNG, JPEG, GIF, WebP, TIFF, BMP, ICO, AVIF, and several others are all supported out of the box. You load an image from disk, get back an object you can inspect or transform, and then write it out to any supported format. The library also includes a set of image processing operations you can apply: resize an image to new dimensions, crop a region out of it, rotate or flip it, convert it to grayscale, adjust brightness or contrast, apply a blur, and more. All of these work on the same image objects the library creates when you open a file. For developers, the library is organized around a few core types. A DynamicImage is the general-purpose container you get when opening a file. An ImageBuffer is a more specific type tied to a particular pixel format, like RGB or RGBA. The library also defines traits that let other crates plug in additional format support, so if you need a format not included by default you can often find a third-party crate that adds it. The README notes that some processing functions run slowly in debug builds and recommends using release mode for any performance-sensitive work. It also recommends that library authors disable the default feature set and opt in only to the specific formats they need, to keep dependency sizes down. This is a mature, actively maintained library used across many Rust projects that involve images.

Copy-paste prompts

Prompt 1
Using the Rust image crate, write code to open a JPEG file, resize it to 200x200 pixels using Lanczos3 filtering, and save it as PNG.
Prompt 2
Show me how to use the image crate to convert a color image to grayscale and apply a Gaussian blur in Rust.
Prompt 3
With the Rust image crate, how do I read pixel data from a PNG and determine whether it has an alpha channel?
Prompt 4
I need to add image processing to a Rust web service. Show me how to accept uploaded bytes, decode them as a DynamicImage, crop a region, and re-encode as JPEG.
Open on GitHub → Explain another repo

← image-rs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.