seamcarving

Crates.ioseamcarving
lib.rsseamcarving
version0.2.3
sourcesrc
created_at2019-07-05 20:28:51.579306
updated_at2020-04-19 22:34:19.977138
descriptionContent-aware image resizing using the seam carving algorithm. Allows changing the aspect ratio of an image without distorting its contents.
homepagehttps://github.com/lovasoa/seamcarving#seamcarving
repositoryhttps://github.com/lovasoa/seamcarving.git
max_upload_size
id146627
size1,479,164
Ophir LOJKINE (lovasoa)

documentation

https://docs.rs/seamcarving

README

seamcarving

A rust library for content-aware image resizing using seam carving.

How to use

Open an image using the image crate, then use the resize function from this create to create a smaller version of the image, while preserving its contents.

let img = image::open("input.jpg")?;
let (width, height) = img.dimensions();
let resized = seamcarving::resize(&img, width/2, height);
resized.save("resized.jpg")?;

Detailed code example

Results

Original Resized
waterfall original waterfall resized with liquid rescaling
butterfly original butterfly resized with liquid rescaling
Commit count: 91

cargo fmt