image-js / fast-png

PNG image decoder and encoder written entirely in JavaScript
MIT License
329 stars 17 forks source link

Web Browser problem #4

Closed photopea closed 7 years ago

photopea commented 8 years ago

Hi, can you make it work in a web browser? I am getting a following error: PNGDecoder.js:3 Uncaught ReferenceError: require is not defined

targos commented 8 years ago

Hello, the library cannot run in the browser directly from the source. You can either use a module bundler like browserify or webpack in your project or load it directly from a browserify CDN

photopea commented 8 years ago

By the way, can you test, if your decoder can correctly decode this file? pea

targos commented 8 years ago

No, sorry. I haven't had time to add support for palette-based images.

targos commented 8 years ago

@photopea I added basic support for palettes in v1.1.0. The decoded image will have two properties:

photopea commented 7 years ago

BTW. I decided to make my own PNG parser. Unlike your library, it fully supports PNG format, including all color depths and interlacing. https://github.com/photopea/UPNG.js .

BTW. why do you develop these parsers? Do you use them in any specific product?