canvas icon indicating copy to clipboard operation
canvas copied to clipboard

PNG Export {alpha: false} has 4 channels

Open adraffy opened this issue 2 years ago • 0 comments

import {createCanvas} from '@napi-rs/canvas';
import {writeFileSync} from 'node:fs';
let n = 100;
let canvas = createCanvas(n, n);
let ctx = canvas.getContext('2d', {alpha: false});
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, n, n);
writeFileSync(new URL('./test.png', import.meta.url), canvas.toBuffer('image/png'));

test.png has 4 channels instead of 3.

adraffy avatar Apr 09 '23 04:04 adraffy