Skip to main content

deployed_width

Function deployed_width 

Source
pub fn deployed_width(natural_w: u32, natural_h: u32) -> u32
Expand description

Width the deployed base variant actually has after the encoder’s aspect-preserving longest-EDGE resize (img.resize(max_edge, max_edge, Lanczos3) in build/media/image.rs). When the longest edge exceeds DEPLOY_MAX_EDGE, BOTH dimensions shrink by the same ratio — for portraits the deployed width is therefore SMALLER than min(w, 2400): a 3024×4032 portrait deploys at 1800×2400, so its base width is 1800.

Integer math (u64 multiply, truncating divide, floor at 1) mirrors the image crate’s resize_dimensions as closely as practical. srcset width descriptors are browser HINTS: ±1px rounding drift vs the encoder’s float .round() is acceptable — a Task-5 cross-check test against real encode output pins gross agreement.