Skip to content

Commit

Permalink
Chore: update JXL
Browse files Browse the repository at this point in the history
  • Loading branch information
woelper committed Sep 17, 2023
1 parent d7ad559 commit 3af9b2a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ turbojpeg = {version = "0.5", features = ["image"], optional = true}
usvg = "0.33.0"
webbrowser = "0.8"
tiff = "0.9"
jxl-oxide = "0.3.0"
jxl-oxide = "0.4"
zune-png = "0.2"
img-parts = "0.3.0"
dark-light = "1.0.0"
Expand Down
15 changes: 7 additions & 8 deletions src/image_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,10 @@ pub fn open_image(img_location: &Path) -> Result<Receiver<Frame>> {

fn foo(img_location: &Path, frame_sender: Sender<Frame>) -> Result<()> {
let mut image = JxlImage::open(img_location).map_err(|e| anyhow!("{e}"))?;
let mut renderer = image.renderer();

debug!("{:#?}", renderer.image_header().metadata);
let is_jxl_anim = renderer.image_header().metadata.animation.is_some();
let ticks_ms = renderer
debug!("{:#?}", image.image_header().metadata);
let is_jxl_anim = image.image_header().metadata.animation.is_some();
let ticks_ms = image
.image_header()
.metadata
.animation
Expand All @@ -252,7 +251,7 @@ pub fn open_image(img_location: &Path) -> Result<Receiver<Frame>> {
loop {
// create a mutable image to hold potential decoding results. We can then use this only once at the end of the loop/
let image_result: DynamicImage;
let result = renderer
let result = image
.render_next_frame()
.map_err(|e| anyhow!("{e}"))
.context("Can't render JXL")?;
Expand All @@ -261,8 +260,8 @@ pub fn open_image(img_location: &Path) -> Result<Receiver<Frame>> {
let frame_duration = render.duration() as u16 * ticks_ms;
debug!("duration {frame_duration} ms");
let framebuffer = render.image();
debug!("{:?}", renderer.pixel_format());
match renderer.pixel_format() {
debug!("{:?}", image.pixel_format());
match image.pixel_format() {
PixelFormat::Graya => {
let float_image = GrayAlphaImage::from_raw(
framebuffer.width() as u32,
Expand Down Expand Up @@ -320,7 +319,7 @@ pub fn open_image(img_location: &Path) -> Result<Receiver<Frame>> {
image_result = DynamicImage::ImageRgb8(float_image);
}
_ => {
bail!("JXL: Pixel format: {:?}", renderer.pixel_format())
bail!("JXL: Pixel format: {:?}", image.pixel_format())
}
}

Expand Down

0 comments on commit 3af9b2a

Please sign in to comment.