10 releases

Uses old Rust 2015

0.2.0 Jan 11, 2017
0.1.0 Dec 22, 2016
0.0.8 Dec 21, 2016
0.0.5 Oct 31, 2016

#971 in Images

Download history 283/week @ 2024-07-26 366/week @ 2024-08-02 641/week @ 2024-08-09 369/week @ 2024-08-16 293/week @ 2024-08-23 325/week @ 2024-08-30 427/week @ 2024-09-06 554/week @ 2024-09-13 858/week @ 2024-09-20 696/week @ 2024-09-27 545/week @ 2024-10-04 370/week @ 2024-10-11 416/week @ 2024-10-18 424/week @ 2024-10-25 717/week @ 2024-11-01 347/week @ 2024-11-08

1,928 downloads per month
Used in 6 crates (4 directly)

MIT license

89KB
1.5K SLoC

Raster

Build Status

An image processing library for Rust.

Documentation

API and detailed documentation can be found here

License

  • MIT License

lib.rs:

Raster

Raster is an image processing lib for Rust.

It provides a simplified API for processing raster images (JPEG, PNG and GIF).

Installation

Add this to your Cargo.toml file:

[dependencies]

raster = "x.x.x"

Where x are version numbers of the latest version of raster. Eg.: 0.1.0

Then add the raster crate in your main.rs:

extern crate raster; // In your main rust file

Creating Images

From an image file

// Create an image from file
let image = raster::open("tests/in/sample.png").unwrap();

Raster will detect the image format based on the file name.

Create a blank image

use raster::Image; // Include the Image struct

// Create a blank 150x100 image. Defaults to a black background.
let image = Image::blank(150, 100);

Saving Images

Save the opened image file:

// Create an image from file
let image = raster::open("tests/in/sample.png").unwrap();

// Save opened image
raster::save(&image, "tests/out/test_open_save.png").unwrap();

Blending 2 Images

Here are two images blended using the normal mode.

More blending modes and options are available, see the blend API.

Resizing Images

An example of images resized to "fit" in a 200x200 box.

More modes available, see the resize API.

Rotating Images

Images can be rotated both clockwise and counter-clockwise at any arbitrary angle with a custom background color.

And Many More...

More options are available, checkout the modules below.

Dependencies

~4.5MB
~81K SLoC