I am utilising a cargo lib called image = 0.23.14 where, I am trying to overlay the image on top of each other.
On their repository, there is an example where you can concat the images side by side.
use image::{
GenericImage,
GenericImageView,
ImageBuffer,
Pixel,
Primitive
};
fn h_concat<I, P, S>(images: &[I]) -> ImageBuffer<P, Vec<S>>
where
I: GenericImageView<Pixel = P>,
P: Pixel<Subpixel = S> + 'static,
S: Primitive + 'static {
let mut imgbuf = image::ImageBuffer::new(100, 100);
for img in images {
imgbuf.copy_from(img, 0, 0).unwrap();
}
imgbug
}
fn main() -> Result<()> {
h_concat(&[
image::open("images/img1.png").unwrap(),
image::open("images/img2.png").unwrap(),
]).save("random.png").unwrap();
Ok(())
}
I am wondering what if I want to append more files together.