Jimp: getBase64() returns `null`

Created on 29 Aug 2017  路  2Comments  路  Source: oliver-moran/jimp

const img_url = "remote-image-url";

Jimp.read(img_url, function (err, image) {
  image.getBase64(Jimp.AUTO, function(data) {
    console.log(data); // null
  });
});

Sorry, I feel like I'm doing something wrong but cannot figure it out. Both buffer and base64 return null. The image read works because I can save it with image.write() and it will save locally.

Most helpful comment

You forgot parameter err in the function

const img_url = "remote-image-url";

Jimp.read(img_url, function (err, image) {
  image.getBase64(Jimp.AUTO, function(err, data) {  // Add err
    console.log(data); 
  });
});

All 2 comments

You forgot parameter err in the function

const img_url = "remote-image-url";

Jimp.read(img_url, function (err, image) {
  image.getBase64(Jimp.AUTO, function(err, data) {  // Add err
    console.log(data); 
  });
});

d'oh! Thanks @avmayorov

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PainKKKiller picture PainKKKiller  路  5Comments

chancein007 picture chancein007  路  5Comments

maqboolkhan picture maqboolkhan  路  5Comments

alyyousuf7 picture alyyousuf7  路  3Comments

master-of-null picture master-of-null  路  3Comments