Skip to content

Instantly share code, notes, and snippets.

@conanak99
Created April 14, 2018 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/0ff0d1ba5690dbc76385f75a6e4a07ad to your computer and use it in GitHub Desktop.
Save conanak99/0ff0d1ba5690dbc76385f75a6e4a07ad to your computer and use it in GitHub Desktop.
async function addMustache(url, output) {
let source = await Jimp.read(url);
// Lấy chiều cao, rộng của ảnh
const { height, width } = source.bitmap;
const mustache = await Jimp.read('mustache.png');
// Thu nhỏ bộ râu lại
mustache.resize(width, Jimp.AUTO);
return source.composite(mustache, 0, 0).write(output);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment