A rust library for content-aware image resizing using seam carving.
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")?;
- resize.rs : command-line image resizing
Original | Resized |
---|---|