I'm doing it like this and it works fine
const png = new PNG({
width: 2048,
height: 2048,
filterType: 4,
});
png.data = mydata;
png.pack().pipe(fs.createWriteStream("image.png"));
but it uses stream and I need it to be sync
I tried the following without success
const png = PNG.sync.read(undefined, {
width: 2048,
height: 2048,
filterType: 4,
});
png.data = mydata;
fs.writeFileSync("image.png", PNG.sync.write(png));