jimp icon indicating copy to clipboard operation
jimp copied to clipboard

rgba(false) returns garbled png

Open crowmagnumb opened this issue 4 years ago • 4 comments

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

icon result

  • Jimp Version: 0.16.1
  • Operating System: Ubuntu 18.04 & macOS 10.15.7
  • Node version: 12.7.0

crowmagnumb avatar Oct 16 '20 22:10 crowmagnumb

Workaround: It was recommended on the above thread to try image.colorType(2) instead of rgba(false) and that seemed to work fine.

crowmagnumb avatar Oct 16 '20 23:10 crowmagnumb

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.

RhianneMoll avatar Feb 16 '21 12:02 RhianneMoll

rgba(false) still doesn't working here (0.22.7 Jimp version), image.colorType(2) did the trick.

venuziano avatar Mar 03 '23 13:03 venuziano

If there is a fix we can merge here more than willing to accept a PR!

hipstersmoothie avatar Mar 22 '23 01:03 hipstersmoothie