Comments (7)
@duyenlv I guess it was my mis-understanding of the spec. A PR was made to fix this issue and I will tag it soon once merged.
Thanks for reporting it and the discussion!
from apngkit.
If I use v1.2.3, this problem is not occurred.
from apngkit.
In fact I am seeing this "stuck" in the Finder preview as below:
It is either a poorly clear flag in the APNG file, or a bug in clearing previous content. I will investigate it when I have time.
from apngkit.
@duyenlv I checked the provided image and now I can say it is an image issue. I will explain it a bit better in following.
I added a frame debugging view controller in the demo app and checked the frames of this image:
The yellow area indicates the full image size, and the orange overlay layer is the drawing area defined in this frame:
- In frame
#5
, the mouse is drawn from{60, 35}
, so it means the ear starting fromY: 35
. - In frame
#6
, it has a disposePrevious
. This flag means, when rendering the next frame (#7
), the content in region of current frame ({60, 38}, 360x329
) should be reverted to the content in the previous frame#5
. - That means, in the rendered image of
#6
, the pixels belowY: 38
will be reverted to those pixels from#5
, then the reverted canvas will be used as the starting point for rendering of frame#7
. - Since the ear of
#5
starts from35
, and the ear of#6
starts from38
, reverting contents below 38 won't change the starting point of ear. - On the other hand, the rendering area of
#7
starts fromY: 45
. That means, any pixel above45
won't get updated.
So, in the following frames, until the pixels above Y: 35
can be drawn again, the ear will keep starting from Y: 35
.
That means, any implementation can display that image without a "persistence" might be doing wrongly. Maybe it is a good idea to check your APNG creating or exporting tool to make sure it is correctly following APNG spec.
Sure I can be wrong, please feel free to let me know if I made a mistake above.
from apngkit.
@onevcat Thanks for your explanation, I encounter this issue with Mac Finder too, I am working for client's project, they ask me a question that the problem isn't occurred while running both Web Browser (you can drag the file to the browser address bar) and Android app (use https://github.com/penfeizhou/APNG4Android), but it's occurred in iOS app (use this library).
So that I have to revert to APNGKit v1.2.3
to make sure the ear doesn't get stuck.
Did you compare your two versions?
from apngkit.
First, the browser implementation for APNG is very buggy, especially for Safari. You may check this page (https://philip.html5.org/tests/apng/tests.html) with Safari to see quite a few red blocks, which indicates the failing case. Especially for the previous
dispose op, it does not follow the APNG spec at all.
APNG_DISPOSE_OP_PREVIOUS: the frame's region of the output buffer is to be reverted to the previous contents before rendering the next frame.
For https://github.com/penfeizhou/APNG4Android, I checked the code and it copies the previous content to the bitmap, but never draw it back to the canvas. (Again, I am not an expert of Android so I can be wrong.)
Also, the old implementation of APNGKit v1.x was definitely wrong.
For now, to me, it is quite strange that the image is using a previous
dispose op in these frames. That flag is being used to keep minimal drawing requirement if most of the content is the same (like the screenshot below). In your case, it is not that case and the easiest solution seems to be recreating your image with all dispose set to background
.
from apngkit.
Version 2.1.2 was released and this issue should be fixed.
from apngkit.
Related Issues (20)
- can use for ARKit HOT 1
- libpng error: attempt to png_read_frame_head() but no acTL present HOT 1
- Tag version 1.2.1 has not been released to CocoaPods, yet. HOT 1
- how to get FPS from APNG ? HOT 1
- How to tint a APNG Image? HOT 1
- 我一个200多k的apng文件,初始化播放后,内存变成好几百m,是什么问题? HOT 1
- Missing PLTE before IDAT HOT 3
- Which release version do you support Swift 5 from ? HOT 1
- It is difficult to reuse the APNGImage data created once.
- Is it possible to add log print property? HOT 3
- Animation get too fast when end scroll
- App 子线程中初始化 APNGImage 偶现 crash
- Question about creating APNG files feature HOT 2
- Errors when building for Xcode 14.3 HOT 2
- Missed frame for image HOT 2
- APNG Animation Playing Too Fast HOT 12
- Add a Privacy Manifest file HOT 2
- how to use in swiftui
- APNG is official now
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 apngkit.