image::imageops

Function interpolate_nearest

source
pub fn interpolate_nearest<P: Pixel>(
    img: &impl GenericImageView<Pixel = P>,
    x: f32,
    y: f32,
) -> Option<P>
Expand description

Image sampling Sample from an image using coordinates in [0, w-1] and [0, h-1], taking the nearest pixel.

Coordinates outside the image bounds will return None, however the behavior for points within half a pixel of the image bounds may change in the future.