Compare commits
No commits in common. 'main' and '440558b15cf9d33bb90da6378ae18482fb8b82eb' have entirely different histories.
main
...
440558b15c
@ -0,0 +1,20 @@
|
|||||||
|
name: Node.js package
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
publish-npm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
- run: npm publish
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
@ -1,5 +1,5 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
tests/
|
test/
|
||||||
pas fait/
|
pas fait/
|
||||||
.vscode/
|
.vscode/
|
Binary file not shown.
Before Width: | Height: | Size: 979 KiB |
Binary file not shown.
Before Width: | Height: | Size: 229 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
Before Width: | Height: | Size: 855 KiB |
@ -1,12 +1,19 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Blur {
|
module.exports = class Blur {
|
||||||
|
/**
|
||||||
|
* Blur
|
||||||
|
* @param {image} image
|
||||||
|
* @param {level} level
|
||||||
|
*/
|
||||||
async getImage(image, level) {
|
async getImage(image, level) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.blur(isNaN(level) ? 5 : parseInt(level));
|
image.blur(isNaN(level) ? 5 : parseInt(level));
|
||||||
return await image.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
image.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,12 +1,18 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Geryscale {
|
module.exports = class Geryscale {
|
||||||
|
/**
|
||||||
|
* Greyscale
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.greyscale();
|
image.greyscale();
|
||||||
return await image.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
image.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,12 +1,18 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Invert {
|
module.exports = class Invert {
|
||||||
|
/**
|
||||||
|
* Invert
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.invert();
|
image.invert();
|
||||||
return await image.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
image.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,12 +1,18 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Sepia {
|
module.exports = class Sepia {
|
||||||
|
/**
|
||||||
|
* Sepia
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.sepia();
|
image.sepia();
|
||||||
return await image.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
image.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,14 +1,18 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Ad {
|
module.exports = class Ad {
|
||||||
|
/**
|
||||||
|
* Ad
|
||||||
|
* @param {image} image1
|
||||||
|
*/
|
||||||
async getImage(image1) {
|
async getImage(image1) {
|
||||||
if (!image1) return console.error(`You must provide an image as an argument`);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
let isValid = await validateURL(image1);
|
const canvas = Canvas.createCanvas(550, 474);
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const image1Buffer = await Jimp.read(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
image1Buffer.resize(230, 230);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/ad.png`);
|
||||||
const background = await Jimp.read(`${__dirname}/../../assets/ad.png`);
|
ctx.drawImage(image1, 150, 75, 230, 230);
|
||||||
background.composite(image1Buffer, 150, 75);
|
ctx.drawImage(background, 0, 0, 550, 474);
|
||||||
return background.getBufferAsync(Jimp.MIME_PNG);
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Affect {
|
module.exports = class Affect {
|
||||||
|
/**
|
||||||
|
* Affect
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
let base = await jimp.read(`${__dirname}/../../assets/affect.png`);
|
let base = await jimp.read(`${__dirname}/../../assets/affect.png`);
|
||||||
let img = await jimp.read(image);
|
let img = await jimp.read(image);
|
||||||
img.resize(200, 157);
|
img.resize(200, 157);
|
||||||
base.composite(img, 180, 383);
|
base.composite(img, 180, 383);
|
||||||
return await base.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
base.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,16 +1,22 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Beautiful {
|
module.exports = class Beautiful {
|
||||||
|
/**
|
||||||
|
* Beautiful
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
let base = await jimp.read(`${__dirname}/../../assets/beautiful.png`);
|
let base = await jimp.read(`${__dirname}/../../assets/beautiful.png`);
|
||||||
base.resize(376, 400);
|
base.resize(376, 400);
|
||||||
let img = await jimp.read(image);
|
let img = await jimp.read(image);
|
||||||
img.resize(84, 95);
|
img.resize(84, 95);
|
||||||
base.composite(img, 258, 28);
|
base.composite(img, 258, 28);
|
||||||
base.composite(img, 258, 229);
|
base.composite(img, 258, 229);
|
||||||
return await base.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
base.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,16 +1,20 @@
|
|||||||
const Jimp = require('jimp');
|
const { createCanvas, loadImage } = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Bobross {
|
module.exports = class Bobross {
|
||||||
async getImage(image1) {
|
/**
|
||||||
if (!image1) return console.error(`You must provide an image as an argument`);
|
* Bobross
|
||||||
let isValid = await validateURL(image1);
|
* @param {image} image1
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
*/
|
||||||
const base = await Jimp.read(`${__dirname}/../../assets/bobross.png`);
|
async getImage(image1) {
|
||||||
const image1Buffer = await Jimp.read(image1);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
image1Buffer.resize(440, 440);
|
const base = await loadImage(`${__dirname}/../../assets/bobross.png`);
|
||||||
const compositeImage = new Jimp(base.getWidth(), base.getHeight(), 0xFFFFFFFF);
|
const canvas = createCanvas(base.width, base.height);
|
||||||
compositeImage.composite(image1Buffer, 15, 20);
|
const ctx = canvas.getContext(`2d`);
|
||||||
compositeImage.composite(base, 0, 0);
|
image1 = await loadImage(image1);
|
||||||
return compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
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();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
const Canvas = require(`canvas`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
|
|
||||||
module.exports = class Clown {
|
|
||||||
async getImage(image) {
|
|
||||||
|
|
||||||
function drawImage(ctx, image, x, y, w, h, degrees) {
|
|
||||||
ctx.save();
|
|
||||||
ctx.translate(x + w / 2, y + h / 2);
|
|
||||||
ctx.rotate(degrees * Math.PI / 180.0);
|
|
||||||
ctx.translate(-x - w / 2, -y - h / 2);
|
|
||||||
ctx.drawImage(image, x, y, w, h);
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!image) throw new Error(`You must provide an image as an argument`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
const canvas = Canvas.createCanvas(610, 343);
|
|
||||||
const ctx = canvas.getContext(`2d`);
|
|
||||||
image = await Canvas.loadImage(image);
|
|
||||||
const background = await Canvas.loadImage(`${__dirname}/../../assets/clown.png`);
|
|
||||||
ctx.fillRect(0, 0, 610, 343);
|
|
||||||
drawImage(ctx, image, 15, 55, 145, 130, -5);
|
|
||||||
ctx.drawImage(background, 0, 0, 610, 343);
|
|
||||||
return canvas.toBuffer();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +1,18 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class ConfusedStonk {
|
module.exports = class ConfusedStonk {
|
||||||
async getImage(image) {
|
/**
|
||||||
if (!image) return console.error(`You must provide an image as an argument`);
|
* ConfusedStonk
|
||||||
let isValid = await validateURL(image);
|
* @param {image} image1
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
*/
|
||||||
const image1 = await Jimp.read(image);
|
async getImage(image1) {
|
||||||
const background = await Jimp.read(`${__dirname}/../../assets/confusedStonk.png`);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
image1.resize(400, 400);
|
const canvas = Canvas.createCanvas(1994, 1296);
|
||||||
const compositeImage = new Jimp(background.getWidth(), background.getHeight(), 0xFFFFFFFF);
|
const ctx = canvas.getContext(`2d`);
|
||||||
compositeImage.composite(image1, 190, 70);
|
image1 = await Canvas.loadImage(image1);
|
||||||
compositeImage.composite(background, 0, 0);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/confusedStonk.png`);
|
||||||
return await compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
ctx.drawImage(image1, 190, 70, 400, 400);
|
||||||
|
ctx.drawImage(background, 0, 0, 1994, 1296);
|
||||||
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
const jimp = require(`jimp`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
|
|
||||||
module.exports = class Deepfry {
|
|
||||||
async getImage(image) {
|
|
||||||
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
|
||||||
image.quality(2)
|
|
||||||
image.contrast(1);
|
|
||||||
image.pixelate(2);
|
|
||||||
image.posterize(10);
|
|
||||||
return await image.getBufferAsync(`image/png`);
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,14 +1,20 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Delete {
|
module.exports = class Delete {
|
||||||
|
/**
|
||||||
|
* Delete
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
let bg = await jimp.read(`${__dirname}/../../assets/delete.png`);
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
const background = await jimp.read(`${__dirname}/../../assets/delete.png`);
|
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.resize(195, 195);
|
image.resize(195, 195);
|
||||||
background.composite(image, 120, 135);
|
bg.composite(image, 120, 135);
|
||||||
return await background.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
bg.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,16 +1,18 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class DiscordBlack {
|
module.exports = class DiscordBlack {
|
||||||
async getImage(image) {
|
/**
|
||||||
if (!image) return console.error(`You must provide an image as an argument`);
|
* Bobross
|
||||||
let isValid = await validateURL(image);
|
* @param {image} image1
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
*/
|
||||||
const background = await Jimp.read(`${__dirname}/../../assets/discordblack.png`);
|
async getImage(image1) {
|
||||||
const image1 = await Jimp.read(image);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
image1.resize(background.getWidth(), background.getHeight());
|
const canvas = Canvas.createCanvas(610, 610);
|
||||||
const compositeImage = new Jimp(background.getWidth(), background.getHeight(), 0xFFFFFFFF);
|
const ctx = canvas.getContext(`2d`);
|
||||||
compositeImage.composite(image1, 0, 0);
|
image1 = await Canvas.loadImage(image1);
|
||||||
compositeImage.composite(background, 0, 0);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/discordblack.png`);
|
||||||
return await compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
ctx.drawImage(image1, 0, 0, 610, 610);
|
||||||
|
ctx.drawImage(background, 0, 0, 610, 610);
|
||||||
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class DiscordBlue {
|
module.exports = class DiscordBlue {
|
||||||
async getImage(image) {
|
/**
|
||||||
if (!image) return console.error(`You must provide an image as an argument`);
|
* Bobross
|
||||||
let isValid = await validateURL(image);
|
* @param {image} image1
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
*/
|
||||||
const background = await Jimp.read(`${__dirname}/../../assets/discordblue.png`);
|
async getImage(image1) {
|
||||||
const image1 = await Jimp.read(image);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
image1.resize(background.getWidth(), background.getHeight());
|
const canvas = Canvas.createCanvas(610, 610);
|
||||||
const compositeImage = new Jimp(background.getWidth(), background.getHeight(), 0xFFFFFFFF);
|
const ctx = canvas.getContext(`2d`);
|
||||||
compositeImage.composite(image1, 0, 0);
|
image1 = await Canvas.loadImage(image1);
|
||||||
compositeImage.composite(background, 0, 0);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/discordblue.png`);
|
||||||
return await compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
ctx.drawImage(image1, 0, 0, 610, 610);
|
||||||
|
ctx.drawImage(background, 0, 0, 610, 610);
|
||||||
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Facepalm {
|
module.exports = class Facepalm {
|
||||||
|
/**
|
||||||
|
* Facepalm
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as an argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
let canvas = Canvas.createCanvas(632, 357);
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
let ctx = canvas.getContext(`2d`);
|
||||||
const layer = await Jimp.read(`${__dirname}/../../assets/facepalm.png`);
|
ctx.fillStyle = `black`;
|
||||||
const avatar = await Jimp.read(image);
|
ctx.fillRect(0, 0, 632, 357);
|
||||||
const compositeImage = new Jimp(layer.getWidth(), layer.getHeight(), 0xFFFFFFFF);
|
let avatar = await Canvas.loadImage(image);
|
||||||
avatar.resize(235, 235);
|
ctx.drawImage(avatar, 199, 112, 235, 235);
|
||||||
compositeImage.composite(avatar, 199, 112);
|
let layer = await Canvas.loadImage(`${__dirname}/../../assets/facepalm.png`);
|
||||||
compositeImage.composite(layer, 0, 0);
|
ctx.drawImage(layer, 0, 0, 632, 357);
|
||||||
return await compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,17 +0,0 @@
|
|||||||
const Canvas = require(`canvas`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
|
|
||||||
module.exports = class Heartbreaking {
|
|
||||||
async getImage(image) {
|
|
||||||
if (!image) throw new Error(`You must provide an image as an argument`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
const canvas = Canvas.createCanvas(610, 797);
|
|
||||||
const ctx = canvas.getContext(`2d`);
|
|
||||||
image = await Canvas.loadImage(image);
|
|
||||||
const background = await Canvas.loadImage(`${__dirname}/../../assets/heartbreaking.png`);
|
|
||||||
ctx.drawImage(image, 0, 150, 610, 610);
|
|
||||||
ctx.drawImage(background, 0, 0, 610, 797);
|
|
||||||
return canvas.toBuffer();
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,14 +1,20 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Hitler {
|
module.exports = class Hitler {
|
||||||
|
/**
|
||||||
|
* Hitler
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
let bg = await jimp.read(`${__dirname}/../../assets/hitler.png`);
|
let bg = await jimp.read(`${__dirname}/../../assets/hitler.png`);
|
||||||
let img = await jimp.read(image);
|
let img = await jimp.read(image);
|
||||||
img.resize(140, 140);
|
img.resize(140, 140);
|
||||||
bg.composite(img, 46, 43);
|
bg.composite(img, 46, 43);
|
||||||
return await bg.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
bg.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,17 +1,18 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Jail {
|
module.exports = class Jail {
|
||||||
|
/**
|
||||||
|
* Jail
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
let bg = await Canvas.loadImage(`${__dirname}/../../assets/jail.png`);
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
let img = await Canvas.loadImage(image);
|
||||||
let bg = await Jimp.read(`${__dirname}/../../assets/jail.png`);
|
const canvas = Canvas.createCanvas(400, 400);
|
||||||
let img = await Jimp.read(image);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const compositeImage = new Jimp(400, 400, 0xFFFFFFFF);
|
ctx.drawImage(img, 0, 0, 400, 400);
|
||||||
img.resize(400, 400);
|
ctx.drawImage(bg, 0, 0, 400, 400);
|
||||||
bg.resize(400, 400);
|
return canvas.toBuffer();
|
||||||
compositeImage.composite(img, 0, 0);
|
|
||||||
compositeImage.composite(bg, 0, 0);
|
|
||||||
return await compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,17 +1,18 @@
|
|||||||
const Jimp = require('jimp');
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Karaba {
|
module.exports = class Mms {
|
||||||
|
/**
|
||||||
|
* MMS
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as an argument`);
|
if (!image) throw new Error(`You must provide an image as an argument`);
|
||||||
let isValid = await validateURL(image);
|
let bg = await Canvas.loadImage(`${__dirname}/../../assets/karaba.png`);
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
let img = await Canvas.loadImage(image);
|
||||||
let bg = await Jimp.read(`${__dirname}/../../assets/karaba.png`);
|
const canvas = Canvas.createCanvas(bg.width, bg.height);
|
||||||
let img = await Jimp.read(image);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const compositeImage = new Jimp(bg.getWidth(), bg.getHeight(), 0xFFFFFFFF);
|
ctx.drawImage(img, 130, 44, 130, 130);
|
||||||
img.resize(130, 130);
|
ctx.drawImage(bg, 0, 0, bg.width, bg.height);
|
||||||
bg.resize(bg.getWidth(), bg.getHeight());
|
return canvas.toBuffer();
|
||||||
compositeImage.composite(img, 130, 44);
|
|
||||||
compositeImage.composite(bg, 0, 0);
|
|
||||||
return await compositeImage.getBufferAsync(Jimp.MIME_PNG);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
const Canvas = require(`canvas`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
|
|
||||||
module.exports = class Mikkelsen {
|
|
||||||
async getImage(image) {
|
|
||||||
if (!image) throw new Error(`You must provide an image as an argument`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
const canvas = Canvas.createCanvas(610, 955);
|
|
||||||
const ctx = canvas.getContext(`2d`);
|
|
||||||
image = await Canvas.loadImage(image);
|
|
||||||
const background = await Canvas.loadImage(`${__dirname}/../../assets/mikkelsen.png`);
|
|
||||||
ctx.drawImage(image, 20, 460, 580, 580);
|
|
||||||
ctx.drawImage(background, 0, 0, 610, 955);
|
|
||||||
return canvas.toBuffer();
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,17 +1,18 @@
|
|||||||
const Jimp = require(`jimp`);
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Mms {
|
module.exports = class Mms {
|
||||||
|
/**
|
||||||
|
* MMS
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
let bg = await Canvas.loadImage(`${__dirname}/../../assets/mms.png`);
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
let img = await Canvas.loadImage(image);
|
||||||
const bg = await Jimp.read(`${__dirname}/../../assets/mms.png`);
|
const canvas = Canvas.createCanvas(400, 400);
|
||||||
const img = await Jimp.read(image);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const canvas = new Jimp(400, 400);
|
ctx.drawImage(img, 60, 10, 270, 270);
|
||||||
bg.resize(400, 400);
|
ctx.drawImage(bg, 0, 0, 400, 400);
|
||||||
img.resize(270, 270);
|
return canvas.toBuffer();
|
||||||
canvas.composite(img, 60, 10);
|
|
||||||
canvas.composite(bg, 0, 0);
|
|
||||||
return canvas.getBufferAsync(Jimp.MIME_PNG);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,17 +1,18 @@
|
|||||||
const Jimp = require(`jimp`);
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class NotStonk {
|
module.exports = class NotStonk {
|
||||||
async getImage(image) {
|
/**
|
||||||
if (!image) return console.error(`You must provide an image as an argument`);
|
* NotStonk
|
||||||
let isValid = await validateURL(image);
|
* @param {image} image1
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
*/
|
||||||
const canvas = new Jimp(960, 576);
|
async getImage(image1) {
|
||||||
const img1 = await Jimp.read(image);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
const background = await Jimp.read(`${__dirname}/../../assets/notStonk.png`);
|
const canvas = Canvas.createCanvas(960, 576);
|
||||||
img1.resize(190, 190);
|
const ctx = canvas.getContext(`2d`);
|
||||||
background.resize(960, 576);
|
image1 = await Canvas.loadImage(image1);
|
||||||
canvas.composite(img1, 140, 5);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/notStonk.png`);
|
||||||
canvas.composite(background, 0, 0);
|
ctx.drawImage(image1, 140, 5, 190, 190);
|
||||||
return canvas.getBufferAsync(Jimp.MIME_PNG);
|
ctx.drawImage(background, 0, 0, 960, 576);
|
||||||
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
const Jimp = require(`jimp`);
|
const Canvas = require(`canvas`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Poutine {
|
module.exports = class Poutine {
|
||||||
async getImage(image) {
|
/**
|
||||||
if (!image) return console.error(`You must provide an image as an argument`);
|
* Ad
|
||||||
let isValid = await validateURL(image);
|
* @param {image} image1
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
*/
|
||||||
const canvas = new Jimp(600, 539);
|
async getImage(image1) {
|
||||||
const img1 = await Jimp.read(image);
|
if (!image1) throw new Error(`You must provide an image as an argument`);
|
||||||
const background = await Jimp.read(`${__dirname}/../../assets/poutine.png`);
|
const canvas = Canvas.createCanvas(600, 539);
|
||||||
canvas.composite(img1, 350, 20);
|
const ctx = canvas.getContext(`2d`);
|
||||||
canvas.composite(background, 0, 0);
|
image1 = await Canvas.loadImage(image1);
|
||||||
return canvas.getBufferAsync(Jimp.MIME_PNG);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/poutine.png`);
|
||||||
|
ctx.drawImage(image1, 350, 20, 135, 135);
|
||||||
|
ctx.drawImage(background, 0, 0, 600, 539);
|
||||||
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
const Canvas = require(`canvas`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
|
|
||||||
module.exports = class Snyder {
|
|
||||||
async getImage(image) {
|
|
||||||
|
|
||||||
function drawImage(ctx, image, x, y, w, h, degrees) {
|
|
||||||
ctx.save();
|
|
||||||
ctx.translate(x + w / 2, y + h / 2);
|
|
||||||
ctx.rotate(degrees * Math.PI / 180.0);
|
|
||||||
ctx.translate(-x - w / 2, -y - h / 2);
|
|
||||||
ctx.drawImage(image, x, y, w, h);
|
|
||||||
ctx.restore();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!image) throw new Error(`You must provide an image as an argument`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
const canvas = Canvas.createCanvas(610, 343);
|
|
||||||
const ctx = canvas.getContext(`2d`);
|
|
||||||
image = await Canvas.loadImage(image);
|
|
||||||
const background = await Canvas.loadImage(`${__dirname}/../../assets/snyder.png`);
|
|
||||||
ctx.fillRect(0, 0, 610, 343);
|
|
||||||
drawImage(ctx, image, 62, 70, 300, 300, -6);
|
|
||||||
ctx.drawImage(background, 0, 0, 610, 343);
|
|
||||||
return canvas.toBuffer();
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,15 +1,21 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Trash {
|
module.exports = class Trash {
|
||||||
|
/**
|
||||||
|
* Trash
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
let bg = await jimp.read(`${__dirname}/../../assets/trash.png`);
|
let bg = await jimp.read(`${__dirname}/../../assets/trash.png`);
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.resize(309, 309);
|
image.resize(309, 309);
|
||||||
image.blur(5);
|
image.blur(5);
|
||||||
bg.composite(image, 309, 0);
|
bg.composite(image, 309, 0);
|
||||||
return await bg.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
bg.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,13 +1,19 @@
|
|||||||
const jimp = require(`jimp`);
|
const jimp = require(`jimp`);
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Circle {
|
module.exports = class Circle {
|
||||||
|
/**
|
||||||
|
* Circle
|
||||||
|
* @param {image} image
|
||||||
|
*/
|
||||||
async getImage(image) {
|
async getImage(image) {
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
if (!image) throw new Error(`You must provide an image as a first argument.`);
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.resize(480, 480);
|
image.resize(480, 480);
|
||||||
image.circle();
|
image.circle();
|
||||||
return await image.getBufferAsync(`image/png`);
|
let raw;
|
||||||
|
image.getBuffer(`image/png`, (err, buffer) => {
|
||||||
|
raw = buffer;
|
||||||
|
});
|
||||||
|
return raw;
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,16 +0,0 @@
|
|||||||
const jimp = require(`jimp`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Denoise {
|
|
||||||
async getImage(image, level = 1) {
|
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
if (isNaN(level)) level = 1;
|
|
||||||
if (level > 10) level = 10;
|
|
||||||
if (level < 1) level = 1;
|
|
||||||
image = await jimp.read(image);
|
|
||||||
// apply gaussBlur
|
|
||||||
image.gaussian(level);
|
|
||||||
return await image.getBufferAsync(`image/png`);
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,12 +0,0 @@
|
|||||||
const jimp = require(`jimp`);
|
|
||||||
const { validateURL } = require(`../functions`);
|
|
||||||
module.exports = class Mirror {
|
|
||||||
async getImage(image, horizontal = true, vertical = false) {
|
|
||||||
if (!image) return console.error(`You must provide an image as a first argument.`);
|
|
||||||
let isValid = await validateURL(image);
|
|
||||||
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
||||||
image = await jimp.read(image);
|
|
||||||
image.flip(horizontal, vertical);
|
|
||||||
return await image.getBufferAsync(`image/png`);
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in New Issue