Function image::imageops::thumbnail [−][src]
pub fn thumbnail<I, P, S>(
image: &I,
new_width: u32,
new_height: u32
) -> ImageBuffer<P, Vec<S>> where
I: GenericImageView<Pixel = P>,
P: Pixel<Subpixel = S> + 'static,
S: Primitive + Enlargeable + 'static,
Resize the supplied image to the specific dimensions.
For downscaling, this method uses a fast integer algorithm where each source pixel contributes to exactly one target pixel. May give aliasing artifacts if new size is close to old size.
In case the current width is smaller than the new width or similar for the height, another strategy is used instead. For each pixel in the output, a rectangular region of the input is determined, just as previously. But when no input pixel is part of this region, the nearest pixels are interpolated instead.
For speed reasons, all interpolation is performed linearly over the colour values. It will not take the pixel colour spaces into account.