diff --git a/services/gam/Cargo.toml b/services/gam/Cargo.toml index a3e0e9a5a..72aac521a 100644 --- a/services/gam/Cargo.toml +++ b/services/gam/Cargo.toml @@ -36,8 +36,6 @@ qrcode = { version = "0.12", default-features = false } #dither = "1.3.10" pending https://gitlab.com/efronlicht/dither/-/merge_requests/28 dither = { git = "https://gitlab.com/nworbnhoj/dither", default-features = false, optional = true } -# note: image version is matched to version used by dither -image = { version = "0.23", default-features = false, features = ["png"], optional = true } [target.'cfg(not(any(windows,unix)))'.dependencies] utralib = {path = "../../utralib"} @@ -45,6 +43,6 @@ utralib = {path = "../../utralib"} [features] debugprint = [] tts = [] -ditherpunk = ["dither", "image"] +ditherpunk = ["dither"] # default = ["debugprint"] # "debugprint" default = [] diff --git a/services/gam/src/bitmap.rs b/services/gam/src/bitmap.rs index 911d86026..4767f4d5e 100644 --- a/services/gam/src/bitmap.rs +++ b/services/gam/src/bitmap.rs @@ -236,11 +236,9 @@ impl From<[Option; 6]> for Bitmap { } } -impl From<&image::RgbImage> for Bitmap { - fn from(image: &image::RgbImage) -> Self { - let pixels: Vec> = image.pixels().map(|p| RGB::from(p.0)).collect(); - let img = Img::new(pixels, image.width()).expect("failed to create dither Img"); - let img = img.convert_with(|rgb: RGB| rgb.convert_with(f64::from)); +impl From>> for Bitmap { + fn from(image: Img>) -> Self { + let img = image.convert_with(|rgb: RGB| rgb.convert_with(f64::from)); let bit_depth = 1; let quantize = dither::create_quantize_n_bits_func(bit_depth).unwrap(); let bw_img = img.convert_with(|rgb| rgb.to_chroma_corrected_black_and_white());