Comments (3)
I think this file contains broken frames. Have you successfully extracted all frames within other tools?
from pyapng.
from pyapng.
The decoding process in your link is not correct. They ignore the image width/height given by the APNG frame.
You can change the width/height of each frame manually by using some tools like tweakpng. After fixing each frame's width/height, you should get an identical result.
Here is a python version that will divide width/height by 10 when they are too large:
import struct
from apng import APNG, make_chunk
im = APNG.open("w.png")
i = 0
first_png = im.frames[0][0]
first_hdr = first_png.chunks[0][1]
for png, ctrl in im.frames:
# fix header
width = png.width
if png.width == 1280:
width = first_png.width
elif png.width >= 1000:
width = png.width // 10
height = png.height
if png.height == 768:
height = first_png.height
elif png.height >= 100:
height = png.height // 10
chunk_data = make_chunk("IHDR", struct.pack("!II", width, height) + first_hdr[16:-4])
png.chunks[0] = ("IHDR", chunk_data)
png.save("{}.png".format(i))
i += 1
from pyapng.
Related Issues (11)
- Fatal error reading PNG image file: Missing PLTE before IDAT HOT 5
- integer out of range for 'I' format code HOT 3
- Pass repeat count by argument HOT 5
- .apng to .gif convert? HOT 1
- Installed apng, but it seems to be empty HOT 2
- Bug handling large PNG files containing multiple data chunks in one frame
- not install the test
- APNG_DISPOSE_OP_PREVIOUS not handled HOT 4
- Rename FrameControl.depose_op to dispose_op
- Add `pyAPNG` to Conda Forge HOT 5
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 pyapng.