1 unstable release

0.0.1 Jul 10, 2022

#33 in #photo

MIT license

2.5MB
363 lines

kodak

Kodak is a Rust crate meant for manipulating images. It makes use of composition APIs, commonly seen in functional languages.

Some typical Kodak code might look like this:

extern crate kodak;
use kodak::*;

// Add a white border around an image.
let border_width = 15;

let img = Image::load_png(String::from("assets/olle_ma.png"))
	.unwrap();
let bordered = Image::blank_with_colour(
	img.get_dimensions().expand(2 * border_width),
	Colour::WHITE)
	.overlay(img, Loc { x: border_width, y: border_width });
bordered.save_png(String::from("border_img.png"));


lib.rs:

Kodak is a crate for image creation and manipulation. It aims to be easy to use, fast and well-documented.

Kodak makes use of chaining API methods, like seen in functional programming languages. A typical piece of Kodak code might look like this:

// Add a white border around an image.
extern crate kodak;
use kodak::*;

let border_width = 16;

let src_img = Image::load_png("assets/olle_voader.png").unwrap();
let new_img = Image::blank(src_img.get_dimensions().expand(2 * border_width))
    .fill(Colour::WHITE)
    .overlay(src_img, Loc { x: border_width, y: border_width });
new_img.save_png("assets/olle_koader.png");

Dependencies