Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/index.js

Created Apr 14, 2018
Embed
What would you like to do?
const Jimp = require("jimp");
async function addMustache(url, output) {
let source = await Jimp.read(url); // Đọc ảnh từ URL
const mustache = await Jimp.read('mustache.png'); // Đọc file râu
// Gắn file râu vào vị trí x=0, y=0, lưu ra output
return source.composite(mustache, 0, 0).write(output);
}
(async () => {
const imageUrl = 'https://pbs.twimg.com/media/DWr05hUXcAA9s8n.jpg';
await addMustache(imageUrl, 'jav_rau.jpg');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.