jimp
jimp copied to clipboard
rgba(false) returns garbled png
Expected Behavior
The alpha channel to be removed from my png without garbling it.
Current Behavior
It returns a garbled image, sans alpha channel though!
Failure Information (for bugs)
Steps to Reproduce
const Jimp = require("jimp");
let src = "icon.png";
Jimp.read(src, (err, image) => {
if (err) {
console.log(err);
return;
}
image.rgba(false).write("result.png");
});
Context
- Jimp Version: 0.16.1
- Operating System: Ubuntu 18.04 & macOS 10.15.7
- Node version: 12.7.0
Workaround: It was recommended on the above thread to try image.colorType(2)
instead of rgba(false)
and that seemed to work fine.
I also experienced this issue with a png image generated from scratch; the above solution worked. Clearly there is a bug and this workaround should perhaps be added to the API doc until it's fixed.
rgba(false) still doesn't working here (0.22.7 Jimp version), image.colorType(2)
did the trick.
If there is a fix we can merge here more than willing to accept a PR!