Function image::math::utils::resize_dimensions
source ยท pub(crate) fn resize_dimensions(
width: u32,
height: u32,
nwidth: u32,
nheight: u32,
fill: bool,
) -> (u32, u32)
Expand description
Calculates the width and height an image should be resized to.
This preserves aspect ratio, and based on the fill
parameter
will either fill the dimensions to fit inside the smaller constraint
(will overflow the specified bounds on one axis to preserve
aspect ratio), or will shrink so that both dimensions are
completely contained within the given width
and height
,
with empty space on one axis.