Created
April 14, 2018 10:50
-
-
Save conanak99/0c1bb45d12ae075e75eb5e01945cbc82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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