Skip to content

Conversation

Quackdoc
Copy link
Contributor

@Quackdoc Quackdoc commented Aug 1, 2025

Support JXL images in preview and thumbnail

Things that need to be solved first

Questions

Should I also wire up using a thumbnailer for the preview pane and perhaps even gallery view? Personally I don't think gallery view should use the thumbnail but preview should.

Should the gallery view not open or should it display a place holder image? A placeholder image could show a "non compatible image" format which may be more user friendly then not opening the gallery at all.

Should I change thumbnailer to use a similar function (see below) or use the nested matches for gallery and preview?

jxl" => {
                    let jxldynimg = (|| {
                        let file = File::open(path).map_err(|err| {
                            log::warn!("failed to open file {:?}: {}", path, err);
                        }).ok()?;
                        let mut limits = image::Limits::default();
                        let max_ram = max_mem * 1000 * 1000 / jobs as u64;
                        limits.max_alloc = Some(max_ram);
                        let mut jxl = JxlDecoder::new(file).map_err(|err| {
                            log::warn!("to create JxlDecoder for {:?}: {}", path, err);
                        }).ok()?;
                        let _ = jxl.set_limits(limits);
                        Some(image::DynamicImage::from_decoder(jxl).map_err(|err| {
                            log::warn!("failed to decode the file {:?}: {}", path, err);
                            }).ok()?
                        )
                    })();
                    //TODO: This will be unwrap_or(generic image)
                    jxldynimg
                }

@Quackdoc Quackdoc force-pushed the jxl-preview-gallery branch from 8cb58dc to 3a9e3ba Compare August 16, 2025 16:55
@Quackdoc
Copy link
Contributor Author

With decoding hooks, tirr-c/jxl-oxide#480 comming up I will use this instead when it lands, I won't close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant