pub fn quantize_levels(
data: Option<&mut [u8]>,
width: i32,
height: i32,
num_levels: i32,
sse: Option<&mut u64>,
) -> boolExpand description
Quantizes the levels of an 8-bit plane to num_levels values with k-means
steps, and stores the sum of squared error in sse when it is given.
Returns false for a missing plane, a non-positive size, or a level count
outside [2, 256]; the plane and sse are then unchanged. The plane is
width * height samples, and data may be longer.
ยงPanics
Panics when data is shorter than width * height.