etemesi254 / zune-image

A fast and memory efficient image library in Rust
Other
332 stars 30 forks source link

`Resize` panics when the new size is the same as the old size on either side #198

Closed hillin closed 6 months ago

hillin commented 6 months ago
use zune_image::{image::Image, traits::OperationsTrait};
use zune_imageprocs::resize::{Resize, ResizeMethod};

fn main() {
    let mut image = Image::from_fn(
        20usize,
        20usize,
        zune_core::colorspace::ColorSpace::RGBA,
        |_y, _x, pixels| {
            pixels[0] = 0u8;
            pixels[1] = 0u8;
            pixels[2] = 0u8;
            pixels[3] = 0xffu8;
        },
    );

    let resize = Resize::new(20usize, 20usize, ResizeMethod::Bilinear);

    resize.execute(&mut image).unwrap();
}

panicked at zune-imageprocs-0.5.0-rc0\src\resize\bilinear.rs:55: index out of bounds: the len is 400 but the index is 400