💖 Bobross

main
adam :) 4 years ago committed by GitHub
parent f0712baaf8
commit 33d5f50312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,22 @@
const { createCanvas, loadImage } = require("canvas");
class Bobross {
/**
* Bobross
* @param {image} image1
*/
async getImage(image1){
if (!image1) throw new Error(`You must provide an image as argument.`);
const base = await loadImage(`${__dirname}/../../assets/bobross.png`);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext("2d");
image1 = await loadImage(image1);
ctx.fillStyle = "white";
ctx.fillRect(0, 0, base.width, base.height);
ctx.drawImage(image1, 15, 20, 440, 440);
ctx.drawImage(base, 0, 0);
return canvas.toBuffer()
}
}
// -N²O Pyro ;)
Loading…
Cancel
Save