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

"Invalid arguments" when pixelBytes set to 0.5 #11

Open
tremby opened this issue Jun 6, 2013 · 0 comments
Open

"Invalid arguments" when pixelBytes set to 0.5 #11

tremby opened this issue Jun 6, 2013 · 0 comments

Comments

@tremby
Copy link

tremby commented Jun 6, 2013

I want to load in some very small images with indexed colour, in the browser. I don't actually want to display the image, only read the colours of the pixels, but documentation is a little thin, and I'm only as far as using the example code to load the image into a canvas element and it's throwing an "invalid arguments" error.

Breaking as the error is thrown shows it's at png.js line 231:

pixels = new Uint8Array(scanlineLength * this.height);

because scanlineLength is set to 7.5.

That was set a few lines earlier, because width is 15 and pixelBytes is 0.5, and pixelBytes is 0.5 because pixelBitLength is 4 and this is divided by 8.

Sample image is at http://tremby.net/dump/finn.png

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

1 participant