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