You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: