Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Browser problem #4

Closed
photopea opened this issue May 18, 2016 · 5 comments
Closed

Web Browser problem #4

photopea opened this issue May 18, 2016 · 5 comments

Comments

@photopea
Copy link

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
Copy link
Member

targos commented May 19, 2016

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
Copy link
Author

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

@targos
Copy link
Member

targos commented May 19, 2016

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

@targos
Copy link
Member

targos commented Jun 12, 2016

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

  • image.palette: an array of arrays. Each element contains the RGB values
  • image.data an array of color indexes referring to the palette array

@targos targos closed this as completed Nov 25, 2016
@photopea
Copy link
Author

photopea commented Apr 2, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants