Comments (12)
Hi, this function is only used for Encoding PNG, not for decoding. What kind of "abnormal" ArrayBuffer did you put into it?
from upng.js.
oh, I copy wrong line.
Line 480 in c62ddc8
Abnormal arraybuffer obtained by FileReader API.
from upng.js.
How long is your ArrayBuffer? What makes it "abnormal" ? Can you send us your PNG file to [email protected] ?
from upng.js.
The image, that you sent us, is a JPG image. This library can work only with PNG images. You should use some different library for parsing JPG images.
from upng.js.
I pay no attention to its size. Looks very small. And log “unknow chunk type”.
You can download here https://github.com/Aqours/APNG-Codec/blob/master/test/elephant.png
Look like iOS cannot download apng.
from upng.js.
I tried to open your APNG with this version of UPNG.js and it works well.
Can you try to update your UPNG.js file? Are you sure you are sending an arraybuffer into decode(), not your FileReader or anything else?
from upng.js.
It works fine if using ArrayBuffer from 'correct' but not FileReader.
ArrayBuffer from FileReader maybe not suitable for UPNG.decode method, but it should not decode infinite loop, because sometimes we don't know whether the ArrayBuffer is suitable for UPNG.decode method or not.
from upng.js.
what do you mean by "correct"? whenever UPNG gets a valid PNG file, it should decode it in finite time.
from upng.js.
demo1 - http://git.hub.moe/laboratory/decode-apng-normal.html (open this link with modern browser)
this demo works fine.
demo2 - http://git.hub.moe/laboratory/decode-apng-abnormal.html
this demo does not work.
you will see some message on browser's console.
from upng.js.
In your picture, I see a message, that your PNG file was not found. This is not related to UPNG.js
The message from UPNG.js basically says, that you are not giving it a PNG file, but some other file (like PDF or EXE or something).
from upng.js.
I mean that unexpected arraybuffer should not cause UPNG.js blocking browser, because sometimes we don't kown whether the arraybuffer decoded by UPNG.js is excepted or not. (Inexistence png is just for demo)
Throw an error or other ways might be better solution.
from upng.js.
Ok, I added some basic PNG check. If the ArrayBuffer on the input is not a PNG file, it should throw an exception.
from upng.js.
Related Issues (20)
- tabs / loop parameter HOT 1
- Encode PNG with specific palette and samples information HOT 1
- Inflation algorithm used for decoding can go into infinite loop HOT 2
- LGTM.com issues in UPNG.js HOT 1
- APNG images at second index until <numimages> gets offset and gets wrong size HOT 9
- How do I encode my ImageData 1-to-1, keeping #12345600 color (RGBA) as it is, not dropping to #00000000? HOT 1
- Uncaught RangeError: byte length of Uint32Array should be a multiple of 4 HOT 5
- Reduce colors of raw ImageData without having to encode then decode a PNG HOT 3
- " Cannot read properties of undefined (reading 'deflate') " HOT 1
- Make png image transparent from reference image HOT 6
- How to tell if my pixel data is incorrect or my code is incorrect HOT 2
- Why use UZIP only when the data length is greater than 10e6? HOT 2
- Check for optional UZIP dependency throws error (for large images) HOT 3
- Make it tree-shakable HOT 10
- Image resizing HOT 1
- Output PNG file size not deterministic HOT 2
- Support for more compression HOT 2
- Uncaught TypeError: Cannot read properties of undefined (reading 'inflate') HOT 3
- 使用upng压缩png图片水波纹比较重,这个大家怎么解决的 HOT 1
- How to resolve this issue? Kindly help HOT 1
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 upng.js.