foliojs / png.js

A (animated) PNG decoder in JavaScript for the HTML5 canvas element and Node.js
http://devongovett.github.com/png.js
MIT License
489 stars 92 forks source link

png.decode callback function #14

Open tlhunter opened 10 years ago

tlhunter commented 10 years ago

The callback function for png.decode should have two arguments. The first should be for handling an error, the second should be the image data.

As it stands, if an image is loaded for a file which does not exist, the cryptic crash happens:

TypeError: Cannot read property '8' of undefined
peterjwest commented 10 years ago

Bump! Just ran into this myself, thanks for raising it.

edi9999 commented 8 years ago

Yes, totally true, this library is not usable as is because of this, because it throws exceptions from nowhere

dceejay commented 8 years ago

Any chance of this being fixed - or is this npm abandoned ? Any good alternatives ?

edi9999 commented 8 years ago

Haven't found any better alternatitves personally ...

dceejay commented 8 years ago

I'm now using pngjs rather than png-js

devongovett commented 8 years ago

I'm using https://github.com/devongovett/png-stream these days.

photopea commented 7 years ago

If you have made a new, better library, what about deleting this one from Github?

edi9999 commented 7 years ago

It shouldn't be deleted from github, but it would be good to show a deprecated sign and link to the new png-stream repository

photopea commented 7 years ago

When you search for "png javascript" on Github, this is the first result. Many people start using it without noticing, that author "does not care" about this library for quite a long time.

Right now, I need to decode PNGs with palettes for my app https://www.Photopea.com and can't find a good library. Many good JS libs are made to work inside Node.js only. I think these bindings are completely unnecessary .