Skip to content

Image artifacting even just with readimage -> writegif no-op #3

@jasonrhodes

Description

@jasonrhodes

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.

homer
homer-noop
ryan-thumb
ryan-thumb-noop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions