pub fn smart_resize(
h: u32,
w: u32,
factor: u32,
min_pixels: u64,
max_pixels: u64,
) -> (u32, u32)Expand description
2026-09-25: Snap each side to the nearest multiple of factor, then rescale
by the area bounds if the snapped canvas violates them.
factor = patch_size * merge_size, and the bounds are areas in pixels.
Returns (h_bar, w_bar), both multiples of factor and at least one
factor each. The initial snap rounds (so a 360-pixel side at factor 28
becomes 364, and the canvas may be larger than the input), the over-budget
branch floors, and the under-budget branch ceils.