Expect to save the image without the alpha channel.
Getting an image byte-wise re-interpretted from RGBA to RGB.
require('jimp').read('test.png', function (err, image) {
image.rgba(false).write('out.png');
})
Screenshots
In (and expected out):

Actual out:

Same issue here. Any updates?
To note, this happens if you use .getBase64 instead of .write as well.
I was able to work around it by turning alpha transparency on then explicitly setting the alpha channel for every pixel.
I think I have found the problem.
It appears that the encoder for PNG files are setting both output AND input alpha channel to image.rgba(). This results in the input being read as RGB instead of RGBA which destroys the output.
The solution should be to change Jimp/packages/type-png/src/index.js:50 from
inputHasAlpha: data._rgba
to
inputHasAlpha: data.bitmap.alpha
I tried to fork it and make the change but one of the tests fail, and I am unable to figure out what the test even does. The important part for me is that the image ends up looking as I expect it to.
Same happens when I try to save a png with rgba(false). The output is all messed like the attached image above user has shared
If you're saving PNGs, then you can try the colorType() method on the image:
image.colorType(0); // Grayscale without alpha
image.colorType(2); // Truecolor without alpha
I'm not Jimp contributor, it's just a thing that I've found out in the docs.
Most helpful comment
If you're saving PNGs, then you can try the
colorType()method on the image:I'm not Jimp contributor, it's just a thing that I've found out in the docs.