Function calculate_padded_width

Source
pub fn calculate_padded_width(
    actual_width: usize,
    sub_sample: SampleRatios,
) -> usize
Expand description

Calculate number of fill bytes added to the end of a JPEG image to fill the image

JPEG usually inserts padding bytes if the image width cannot be evenly divided into 8 , 16 or 32 chunks depending on the sub sampling ratio. So given a sub-sampling ratio, and the actual width, this calculates the padded bytes that were added to the image

§Params

-actual_width: Actual width of the image -sub_sample: Sub sampling factor of the image

§Returns

The padded width, this is how long the width is for a particular image