Fix grayscale bug
This commit is contained in:
parent
af3556d19d
commit
2adec543ab
12
Cargo.toml
12
Cargo.toml
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libcaesium"
|
name = "libcaesium"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
authors = ["Matteo Paonessa <matteo.paonessa@gmail.com>"]
|
authors = ["Matteo Paonessa <matteo.paonessa@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
categories = ["multimedia::images"]
|
categories = ["multimedia::images"]
|
||||||
|
@ -24,13 +24,13 @@ license = "Apache-2.0"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mozjpeg-sys = "1.0.1"
|
mozjpeg-sys = "1.0.1"
|
||||||
oxipng = "5.0.1"
|
oxipng = "5.0.1"
|
||||||
libc = "0.2.119"
|
libc = "0.2"
|
||||||
gifsicle = "1.92.5"
|
gifsicle = "1.92.5"
|
||||||
webp = "0.2.1"
|
webp = "0.2"
|
||||||
infer = "0.7.0"
|
infer = "0.7"
|
||||||
image = { version = "0.24", default-features = false, features = ["jpeg", "png", "webp", "gif"] }
|
image = { version = "0.24", default-features = false, features = ["jpeg", "png", "webp", "gif"] }
|
||||||
img-parts = "0.2.3"
|
img-parts = "0.2"
|
||||||
bytes = "1.1.0"
|
bytes = "1.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
dssim = "3.2.0"
|
dssim = "3.2.0"
|
||||||
|
|
|
@ -134,7 +134,7 @@ unsafe fn lossy(in_file: Vec<u8>, parameters: CSParameters) -> Result<(*mut u8,
|
||||||
dst_info.image_width = width;
|
dst_info.image_width = width;
|
||||||
dst_info.image_height = height;
|
dst_info.image_height = height;
|
||||||
dst_info.in_color_space = color_space;
|
dst_info.in_color_space = color_space;
|
||||||
dst_info.input_components = 3;
|
dst_info.input_components = if color_space == J_COLOR_SPACE::JCS_GRAYSCALE { 1 } else { 3 };
|
||||||
jpeg_set_defaults(&mut dst_info);
|
jpeg_set_defaults(&mut dst_info);
|
||||||
|
|
||||||
let row_stride = dst_info.image_width as usize * dst_info.input_components as usize;
|
let row_stride = dst_info.image_width as usize * dst_info.input_components as usize;
|
||||||
|
|
Loading…
Reference in New Issue