19 lines
835 B
JavaScript
19 lines
835 B
JavaScript
const gm = require("gm").subClass({
|
|
imageMagick: true
|
|
});
|
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
|
|
exports.run = async (message) => {
|
|
const image = await require("../utils/imagedetect.js")(message);
|
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`;
|
|
message.channel.sendTyping();
|
|
gm(image.data).resize(128).stream(async (error, output) => {
|
|
if (error) console.error;
|
|
const data = gm(output).virtualPixel("tile").matteColor("none").out("-background", "none").resize("512x512!").out("-distort").out("Perspective").out("0,0,57,42 0,128,63,130 128,0,140,60 128,128,140,140");
|
|
const resultBuffer = await gmToBuffer(data);
|
|
return message.channel.createMessage("", {
|
|
file: resultBuffer,
|
|
name: `wall.${image.type}`
|
|
});
|
|
});
|
|
};
|