It's hard for me to narrow down if this is a problem with writegif or with readimage, but I've noticed that while unaltered meatspace GIFs come out of readimage/writegif perfectly, a lot of other GIFs come through with strange pixel artifacting.
Simplest reproduction:
function makeDataUri(type, buffer) {
return 'data:' + type + ';base64,' + buffer.toString('base64');
}
function imgTag(image) {
return "<img src='" + makeDataUri("image/gif", image) + "' />";
}
// readimage/writegif no-op
function writegiftest(buffer, cb) {
readimage(buffer, function (err, buf) {
writegif(buf, cb);
});
}
// Express.js route
app.get("/writegiftest", function (req, res) {
fs.readFile("./gifs/example.gif", function (err, buffer) {
if (err) {
res.send(err);
return;
}
writegiftest(buffer, function (err, image) {
res.send(imgTag(image));
});
});
You can see two examples below, one is a Photoshop-resized meatspace GIF, the other is just a GIF of Homer Simpson from GIS.




It's hard for me to narrow down if this is a problem with writegif or with readimage, but I've noticed that while unaltered meatspace GIFs come out of readimage/writegif perfectly, a lot of other GIFs come through with strange pixel artifacting.
Simplest reproduction:
You can see two examples below, one is a Photoshop-resized meatspace GIF, the other is just a GIF of Homer Simpson from GIS.