Giter Site home page Giter Site logo

Comments (10)

woelper avatar woelper commented on June 9, 2024

Thanks! Great idea! Do you happen to know what is required to know if a PNG is animated? The extension is the same as PNG, so I guess some pre-check for animation would need to be done.

from oculante.

bean-z avatar bean-z commented on June 9, 2024

The way that the png docs demonstrate is creating a Decoder, calling the read_info() method (which returns a Reader), and passing a mutable reference to a vec! buffer into the Reader's next_frame() method. I think it works like this: If there is only one frame (i.e. not APNG) then the first next_frame() call will return something that matches Ok(variable_to_bind_info) (and will fill the buffer with the first frame's bytes) and a second call will return something that matches Err(Format(FormatError)) (where Format(FormatError) is a variant of the enum DecodingError).

Internally, the .png file should contain the acTL chunk (whose header contains the four hex bytes 61 63 54 4c i.e. "acTL") prior to the IDAT chunk (whose header contains the four bytes 49 44 41 54 i.e. "IDAT").

from oculante.

woelper avatar woelper commented on June 9, 2024

Thanks!

It seems that zune_png supports apng, it just needs manual handling. I have made a branch that successfully decodes the sample animation you linked (thank you for such a well-written feature request by the way!). I'll test this a bit more and release.

from oculante.

woelper avatar woelper commented on June 9, 2024

I've found one animation that looks like the offset is incorrectly calculated here:
http://littlesvr.ca/apng/images/clock.png
I am using https://docs.rs/zune-png/latest/zune_png/fn.post_process_image.html to do post processing, so the bug is likely there, or in the image itself. All other examples decoded correctly as far as I could see.

from oculante.

woelper avatar woelper commented on June 9, 2024

I've released v0.8.18 with APNG support now. Please let me know if this works as expected. Thank you again for this request.

from oculante.

bean-z avatar bean-z commented on June 9, 2024

The bouncing ball animation has minor visual artifacts at the top and bottom edges of the ball when displayed in Oculante version 0.8.18. Here's a recording of Oculante on the left and Brave (a Chromium-based browser) on the right:

bouncing-ball-left-oculante-right-chromium-browser.mp4

From what I can tell, Oculante correctly displays this brain scan animation and this elephant animation.

from oculante.

woelper avatar woelper commented on June 9, 2024

Well spotted!

This seems like to be an issue in zune_png. I've made a minimal example based on their example to decode an animation here:

https://github.com/woelper/apng_test

I think it looks like I need to open an issue in their repo. I could try using the png crate, but I'd love to not mix multiple libraries if possible.

from oculante.

woelper avatar woelper commented on June 9, 2024

I have added an issue here:

etemesi254/zune-image#185

from oculante.

woelper avatar woelper commented on June 9, 2024

I've merged the latest rc from zune-png and all examples look correct now.

from oculante.

bean-z avatar bean-z commented on June 9, 2024

Version 0.8.22 can open the clock and the MRI scan images, but I get a crash if I try to open the bouncing ball or the elephant.

I got a log in my terminal by running /Applications/oculante.app/Contents/MacOS/oculante with the environment variable RUST_BACKTRACE=1. First I dragged the MRI scan image into the app. Then I dragged in the bouncing ball.

[2024-05-20T02:04:53Z INFO  oculante::image_loader] Image is animated
[2024-05-20T02:05:04Z INFO  oculante::image_loader] Image is animated
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zune-png-0.5.0-rc1/src/apng.rs:269:28:
range end index 400 out of range for slice of length 100
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

from oculante.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.