Skip to main content

center_crop_square

Function center_crop_square 

Source
pub fn center_crop_square(
    pixels: &[u8],
    width: u32,
    height: u32,
) -> (Vec<u8>, u32)
Expand description

Crop the source RGBA buffer to a centered square of edge min(w, h). The returned buffer is side * side * 4 bytes. If the input is already square, a copy of the original is returned.