The library provides a way to move a given image to a specified (x, y)
location while the pixels are repeated if they are out of the boundary.
To do this, we can use translate.
use imageproc::{
geometric_transformations,
image::{ImageBuffer, Rgb},
};
fn main() {
let img = imageproc::image::open("my_image.jpg").unwrap();
let buf: ImageBuffer<Rgb<u8>, Vec<u8>> = img.into();
let img2 = geometric_transformations::translate(&buf, (256, 128));
img2.save("translate.jpg").unwrap();
}
Note that we need to transform the input image to a appropriate ImageBuffer before we call the function.
translate.jpg:
📘 Back: Table of contents