Comments (10)
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.
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.
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.
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.
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.
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.
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.
I have added an issue here:
from oculante.
I've merged the latest rc from zune-png and all examples look correct now.
from oculante.
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)
- Gifs piped into oculante do not animate HOT 3
- native wayland support HOT 2
- Ensure window size can't be too small HOT 1
- Webp images with large size don't get loaded HOT 1
- Image displayed wrong compared to other applications HOT 3
- Allow configurable min window size HOT 1
- No dependencies in Cargo.lock for build with options: --no-default-features notan/shaderc HOT 5
- error[E0599]: no variant or associated item named `get_mouse_position` found for enum `mouse_position::mouse_position::Mouse` in the current scope HOT 7
- heif support via avif-decode
- ERROR rfd::backend::xdg_desktop_portal HOT 5
- Transparency in images shows contents below oculante HOT 8
- GIFs increase in speed when workspace is switched HOT 1
- "Show checker background" option doesn't work" HOT 1
- A JPG file starting with 0x52 0x49 can't be opened HOT 3
- The executable icon on Windows is only available in 48x48px HOT 1
- Delete and overwrite operations should ask for a confirmation HOT 2
- Can't open JPG files made on Sony NEX-3N HOT 3
- Add an option to contain and center images within the viewport HOT 3
- Ability to close images HOT 2
- If TurboJPEG fails to read an image, try opening with the `image` library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oculante.