Feat: tell jxl-oxide to decode to sRGB

This commit is contained in:
Mitchel Stewart 2024-10-11 05:27:19 -04:00
parent a4870d741f
commit 19902f6d34
2 changed files with 7 additions and 2 deletions

View file

@ -96,7 +96,7 @@ libblur = "0.13.5"
egui-modal = "0.3.6"
[features]
default = ["turbo", "avif_native", "update", "notan/glsl-to-spirv", "j2k"]
default = ["turbo", "avif_native", "update", "notan/glsl-to-spirv", "j2k", "jxlcms"]
heif = ["libheif-rs"]
avif_native = ["avif-decode"]
dav1d = ["libavif-image"]
@ -104,6 +104,7 @@ file_open = ["rfd"]
turbo = ["turbojpeg"]
update = ["self_update"]
j2k = ["jpeg2k"]
jxlcms = ["jxl-oxide/lcms2"]
[target.'cfg(target_os = "macos")'.dependencies]

View file

@ -363,9 +363,13 @@ pub fn open_image(
//TODO this needs to be a thread
fn foo(img_location: &Path, frame_sender: Sender<Frame>) -> Result<()> {
let image = JxlImage::builder()
let mut image = JxlImage::builder()
.open(img_location)
.map_err(|e| anyhow!("{e}"))?;
//TODO: Disable when colormanagement support exists
let colorencoding = jxl_oxide::EnumColourEncoding::srgb(jxl_oxide::RenderingIntent::Perceptual);
image.request_color_encoding(colorencoding);
debug!("{:#?}", image.image_header().metadata);
let is_jxl_anim = image.image_header().metadata.animation.is_some();
let ticks_ms = image