image-effects 0.1.0

An assortment of effects that can be applied to an image with the help of `image`.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[inline] pub fn sum(nums: &[u8]) -> usize {
    return nums.iter().fold(0, |acc, &e| acc + e as usize);
}

#[inline] pub fn average(nums: &[u8]) -> f64 {
    return sum(nums) as f64 / nums.len() as f64;
}

#[inline] pub fn map_to_2d(cell_no: usize, xdim: usize) -> (usize, usize) {
    (
        cell_no % xdim,
        cell_no / xdim,
    )
}