Tests + Bug Fixes

* Test cases for LSB extraction, RGBA extraction and bit plane browsing
* Bug fix for alpha planes in bit plane browser
This commit is contained in:
Ge0rg3 2019-08-28 17:03:55 +01:00
parent 48831225ac
commit 950a12360e
3 changed files with 59 additions and 4 deletions

View file

@ -62,7 +62,6 @@ class ViewBitPlane extends Operation {
throw new OperationError("Error: Bit argument must be between 0 and 7");
}
parsedImage.rgba(true);
let pixel, bin, newPixelValue;
@ -73,9 +72,11 @@ class ViewBitPlane extends Operation {
if (bin.charAt(bitIndex) === "1") newPixelValue = 0;
for (let i=0; i < 4; i++) {
for (let i=0; i < 3; i++) {
this.bitmap.data[idx + i] = newPixelValue;
}
this.bitmap.data[idx + 3] = 255;
});
const imageBuffer = await parsedImage.getBufferAsync(jimp.AUTO);