Function downsample_with_custom_scale

Source
pub fn downsample_with_custom_scale(
    src: &Image<'_, AlbedoFormat>,
    target_width: u32,
    target_height: u32,
    filter_scale: f32,
) -> Vec<u8> 
Expand description

Version of downsample which allows for a custom filter scale, thus trading between speed and final image quality.

filter_scale controls how many samples are made relative to the size ratio between the source and target resolutions. The higher the scale, the more detail is preserved, but the slower the downsampling is. Note that the effect on the detail becomes smaller the higher the scale is.

As a guideline, a filter_scale of 3.0 preserves detail well. A scale of 1.0 preserves is good if speed is necessary, but still preserves a decent amount of detail. Anything below is even faster, although the loss of detail becomes clear.