Skip to content

Edges of image are upscaled incorrectly with Point mode #30

@xmakro

Description

@xmakro

A 2x2 grayscale image:

[1, 0,
 0, 2]

Is incorrectly upscaled to the following 4x4 image:

[1, 0, 0, 0, 
 0, 2, 2, 2, 
 0, 2, 2, 2, 
 0, 2, 2, 2]

This can be reproduced with:

fn main() {
    let mut resizer = resize::new(2, 2, 4, 4, resize::Pixel::Gray8, resize::Type::Point).unwrap();
    let src = vec![1u8, 0u8, 0u8, 2u8];
    let mut dst = vec![0u8; 4 * 4];
    resizer.resize(&src, &mut dst).unwrap();
    println!("{:?}", dst);
    // prints: [1, 0, 0, 0, 0, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2]
}

I only observe this behavior for the edges of the image, the center part of the image is upscaled correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions