fn grayscale_alpha_to_grayscale(data: &[u8]) -> Vec<u8> {
        let mut temp_counter = 0;
        let mut temp = 0u8;
        let mut output = Vec::with_capacity(data.len() / 2);
        for byte in data {
            match temp_counter {
                0 => {
                    // Store value h.
                    temp = *byte;
                    // Increase counter
                    temp_counter += 1;
                }
                _ => {
                    // Skip alpha
                    // and
                    // Color of 1 pixel is consumes (g, a)
                    output.push(temp);
                    temp_counter = 0;
                }
            }
        }
        output
    }
// NOTE: This function only works for a bit depth of 8.
This function only works for a bit depth of 8.
This function only works for a bit depth of 8 .
fn grayscale_alpha_to_grayscale(data: &[u8]) -> Vec<u8> {
        let mut temp_counter = 0;
        let mut temp = 0u8;
        let mut output = Vec::with_capacity(data.len() / 2);
        for byte in data {
            match temp_counter {
                0 => {
                    // Store value h.
                    temp = *byte;
                    // Increase counter
                    temp_counter += 1;
                }
                _ => {
                    // Skip alpha
                    // and
                    // Color of 1 pixel is consumes (g, a)
                    output.push(temp);
                    temp_counter = 0;
                }
            }
        }
        output
    }
fn grayscale_alpha_to_grayscale ( data : & [ u8 ] ) -> Vec < u8 > { let mut temp_counter = 0 ; let mut temp = 0u8 ; let mut output = Vec :: with_capacity ( data . len ( ) / 2 ) ; for byte in data { match temp_counter { 0 => { // Store value h. temp = * byte ; // Increase counter temp_counter += 1 ; } _ => { // Skip alpha // and // Color of 1 pixel is consumes (g, a) output . push ( temp ) ; temp_counter = 0 ; } } } output }
NOTE: This function only works for a bit depth of 8.
NOTE : This function only works for a bit depth of 8 .
data
&[u8]