Removed duplicate type parameter, made image commands use a promisified version of the default toBuffer method
This commit is contained in:
parent
3513245fda
commit
5455b2682c
44 changed files with 104 additions and 174 deletions
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a 9GAG watermark!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a 9GAG watermark!`;
|
||||||
const watermark = "./assets/images/9gag.png";
|
const watermark = "./assets/images/9gag.png";
|
||||||
const data = gm(image.path).coalesce().out("null:").out(watermark).gravity("East").out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("East").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `9gag.${image.outputType}`
|
name: `9gag.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`;
|
||||||
const watermark = "./assets/images/bandicam.png";
|
const watermark = "./assets/images/bandicam.png";
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const data = gm(image.path).coalesce().out("null:").out(watermark).gravity("North").resize(null, size.height).out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("North").resize(null, size.height).out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `bandicam.${image.outputType}`
|
name: `bandicam.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`;
|
||||||
const command = gm(image.path).blur(10);
|
const buffer = await gm(image.path).blur(15).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `blur.${image.outputType}`
|
name: `blur.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to make blurple!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make blurple!`;
|
||||||
const data = gm(image.path).threshold(75, true).out("+level-colors").out("\"#7289DA\",white");
|
const buffer = await gm(image.path).threshold(75, true).out("+level-colors").out("\"#7289DA\",white").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `blurple.${image.outputType}`
|
name: `blurple.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
//const upload = require("../utils/upload.js");
|
//const upload = require("../utils/upload.js");
|
||||||
|
|
||||||
exports.run = async (message, args) => {
|
exports.run = async (message, args) => {
|
||||||
|
@ -10,17 +9,15 @@ exports.run = async (message, args) => {
|
||||||
if (args.length === 0) return `${message.author.mention}, you need to provide some text to add a caption!`;
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to add a caption!`;
|
||||||
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const command = gm().out("-size", `${size.width}x`).background("white").fill("black").font("./assets/caption.otf", size.width / 10).gravity("Center").out(`caption:${args.join(" ")}`);
|
const output = await gm().out("-size", `${size.width}x`).background("white").fill("black").font("./assets/caption.otf", size.width / 10).gravity("Center").out(`caption:${args.join(" ")}`).bufferPromise("png");
|
||||||
const output = await gmToBuffer(command, "png");
|
|
||||||
const size2 = await gm(output).sizePromise();
|
const size2 = await gm(output).sizePromise();
|
||||||
const output2 = await gm(output).gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).streamPromise();
|
const output2 = await gm(output).gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).streamPromise();
|
||||||
const command3 = gm(output2).out("-alpha", "set").background("none").out("(").out(image.path).out("-coalesce").out(")").colorspace("sRGB").out("-set", "page", "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]").out("-coalesce").out("null:").out("-insert", 1).out("-layers", "composite");
|
const outputFinal = await gm(output2).out("-alpha", "set").background("none").out("(").out(image.path).out("-coalesce").out(")").colorspace("sRGB").out("-set", "page", "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]").out("-coalesce").out("null:").out("-insert", 1).out("-layers", "composite").bufferPromise(image.type);
|
||||||
const outputFinal = await gmToBuffer(command3, image.outputType);
|
|
||||||
await processMessage.delete();
|
await processMessage.delete();
|
||||||
//return upload(message, outputFinal, `caption.${image.type}`);
|
//return upload(message, outputFinal, `caption.${image.type}`);
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: outputFinal,
|
file: outputFinal,
|
||||||
name: `caption.${image.outputType}`
|
name: `caption.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add radial blur!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add radial blur!`;
|
||||||
const data = gm(image.path).coalesce().out("-radial-blur", 10);
|
const buffer = await gm(image.path).coalesce().out("-radial-blur", 10).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `circle.${image.outputType}`
|
name: `circle.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`;
|
||||||
const watermark = "./assets/images/deviantart.png";
|
const watermark = "./assets/images/deviantart.png";
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const data = gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, size.height).out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, size.height).out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `deviantart.${image.outputType}`
|
name: `deviantart.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to explode!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to explode!`;
|
||||||
const data = gm(image.path).coalesce().implode([-2]);
|
const buffer = await gm(image.path).coalesce().implode([-2]).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `explode.${image.outputType}`
|
name: `explode.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to flip!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to flip!`;
|
||||||
const command = gm(image.path).flip();
|
const buffer = await gm(image.path).flip().bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `flip.${image.outputType}`
|
name: `flip.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to flop!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to flop!`;
|
||||||
const command = gm(image.path).flop();
|
const buffer = await gm(image.path).flop().bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `flop.${image.outputType}`
|
name: `flop.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`;
|
||||||
const watermark = "./assets/images/funky.png";
|
const watermark = "./assets/images/funky.png";
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const data = gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthEast").resize(null, size.height).out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthEast").resize(null, size.height).out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `funky.${image.outputType}`
|
name: `funky.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(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 GameXplain thumbnail meme!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a GameXplain thumbnail meme!`;
|
||||||
const template = "./assets/images/gamexplain.png";
|
const template = "./assets/images/gamexplain.png";
|
||||||
const command = gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("1181x571!").out(")").compose("over").gravity("Center").out("-geometry", "+0+40").out("-layers", "composite");
|
const buffer = await gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("1181x571!").out(")").compose("over").gravity("Center").out("-geometry", "+0+40").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `gamexplain.${image.outputType}`
|
name: `gamexplain.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -12,11 +11,10 @@ exports.run = async (message) => {
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data2);
|
await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data2);
|
||||||
await gm(data2).flop().writePromise(data);
|
await gm(data2).flop().writePromise(data);
|
||||||
const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite");
|
const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `haah.${image.outputType}`
|
name: `haah.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message, args) => {
|
exports.run = async (message, args) => {
|
||||||
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Homebrew Channel edit!`;
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Homebrew Channel edit!`;
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const template = "./assets/images/hbc.png";
|
const template = "./assets/images/hbc.png";
|
||||||
const cleanedMessage = args.join(" ").toLowerCase().replace(/\n/g, " ");
|
const cleanedMessage = args.join(" ").toLowerCase().replace(/\n/g, " ");
|
||||||
const command = gm(template).gravity("Center").font("./assets/hbc.ttf").out("-kerning", "-5").fill("white").pointSize(96).drawText(0, 0, cleanedMessage);
|
const buffer = await gm(template).gravity("Center").font("./assets/hbc.ttf").out("-kerning", "-5").fill("white").pointSize(96).drawText(0, 0, cleanedMessage).bufferPromise("png");
|
||||||
const buffer = await gmToBuffer(command);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: "homebrew.png"
|
name: "homebrew.png"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -12,11 +11,10 @@ exports.run = async (message) => {
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data2);
|
await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data2);
|
||||||
await gm(data2).flip().writePromise(data);
|
await gm(data2).flip().writePromise(data);
|
||||||
const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite");
|
const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `hooh.${image.outputType}`
|
name: `hooh.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`;
|
||||||
const watermark = "./assets/images/hypercam.png";
|
const watermark = "./assets/images/hypercam.png";
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const data = gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthWest").resize(null, size.height).out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthWest").resize(null, size.height).out("-layers", "composite").bufferPromse(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `hypercam.${image.outputType}`
|
name: `hypercam.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`;
|
||||||
const watermark = "./assets/images/ifunny.png";
|
const watermark = "./assets/images/ifunny.png";
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const data = gm(image.path).coalesce().out("null:").out(watermark).gravity("South").resize(size.width, null).out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("South").resize(size.width, null).out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `ifunny.${image.outputType}`
|
name: `ifunny.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to implode!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to implode!`;
|
||||||
const data = gm(image.path).implode([1]);
|
const buffer = await gm(image.path).implode([1]).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `implode.${image.outputType}`
|
name: `implode.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to invert!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to invert!`;
|
||||||
const data = gm(image.path).negative();
|
const buffer = await gm(image.path).negative().bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `invert.${image.outputType}`
|
name: `invert.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add more JPEG!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add more JPEG!`;
|
||||||
const data = gm(image.path).setFormat("jpg").quality(1);
|
const buffer = await gm(image.path).setFormat("jpg").quality(1).bufferPromise("jpg");
|
||||||
const buffer = await gmToBuffer(data);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: "jpeg.jpg"
|
name: "jpeg.jpg"
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(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 Super Smash Bros. leak meme!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Super Smash Bros. leak meme!`;
|
||||||
if (image.type === "gif" || image.type === "mp4") return `${message.author.mention}, this command doesn't work with GIFs!`;
|
if (image.type === "gif") return `${message.author.mention}, this command doesn't work with GIFs!`;
|
||||||
const template = "./assets/images/leak.png";
|
const template = "./assets/images/leak.png";
|
||||||
const command = gm(template).out("-background").out("white").out("-gravity").out("Center").out("(").out("-clone").out("0").out("(").out(image.path).out("-virtual-pixel").out("white").out("-resize").out("640x360!").rotate("white", 15).out(")").out("-geometry").out("+450-200").out("-composite").out(")").out("+swap").out("-composite").out("-alpha").out("remove").out("-alpha").out("off");
|
const buffer = await gm(template).out("-background").out("white").out("-gravity").out("Center").out("(").out("-clone").out("0").out("(").out(image.path).out("-virtual-pixel").out("white").out("-resize").out("640x360!").rotate("white", 15).out(")").out("-geometry").out("+450-200").out("-composite").out(")").out("+swap").out("-composite").out("-alpha").out("remove").out("-alpha").out("off").bufferPromise(image.type);
|
||||||
// const command = gm(template).out("-background", "white").gravity("Center").out("null:").out("(").out(path).out("-resize", "640x360!").out("-virtual-pixel", "white").rotate("white", 15).coalesce().geometry("+450-200").out(")").compose("over").out("-alpha", "remove").out("-alpha", "off").out("-layers", "composite");
|
// const command = gm(template).out("-background", "white").gravity("Center").out("null:").out("(").out(path).out("-resize", "640x360!").out("-virtual-pixel", "white").rotate("white", 15).coalesce().geometry("+450-200").out(")").compose("over").out("-alpha", "remove").out("-alpha", "off").out("-layers", "composite");
|
||||||
const buffer = await gmToBuffer(command);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `leak.${image.outputType}`
|
name: `leak.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`;
|
||||||
if (image.type === "gif" || image.type === "mp4") return `${message.author.mention}, this command doesn't work with GIFs!`;
|
if (image.type === "gif") return `${message.author.mention}, this command doesn't work with GIFs!`;
|
||||||
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
||||||
const stream = await gm(image.path).coalesce().resize(600, 600).streamPromise("miff");
|
const stream = await gm(image.path).coalesce().resize(600, 600).streamPromise("miff");
|
||||||
const stream2 = await gm(stream).out("-liquid-rescale", "300x300").streamPromise();
|
const stream2 = await gm(stream).out("-liquid-rescale", "300x300").streamPromise();
|
||||||
const data = gm(stream2).out("-liquid-rescale", "800x800");
|
const resultBuffer = await gm(stream2).out("-liquid-rescale", "800x800").bufferPromise(image.type);
|
||||||
const resultBuffer = await gmToBuffer(data, image.outputType);
|
|
||||||
await processMessage.delete();
|
await processMessage.delete();
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: resultBuffer,
|
file: resultBuffer,
|
||||||
name: `magik.${image.outputType}`
|
name: `magik.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message, args) => {
|
exports.run = async (message, args) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -16,11 +15,10 @@ exports.run = async (message, args) => {
|
||||||
const size = await gm(file).sizePromise();
|
const size = await gm(file).sizePromise();
|
||||||
await gm().out("-size", size.width).background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${topText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}</span>`).out(")", "(", "+clone").out("-channel", "A").out("-morphology", "EdgeOut", "Octagon", "+channel", "+level-colors", "black", ")").compose("DstOver").out(")", "-composite").writePromise(file2);
|
await gm().out("-size", size.width).background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${topText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}</span>`).out(")", "(", "+clone").out("-channel", "A").out("-morphology", "EdgeOut", "Octagon", "+channel", "+level-colors", "black", ")").compose("DstOver").out(")", "-composite").writePromise(file2);
|
||||||
if (bottomText) await gm().out("-size", size.width).background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${bottomText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}</span>`).out(")", "(", "+clone").out("-channel", "A").out("-morphology", "EdgeOut", "Octagon", "+channel", "+level-colors", "black", ")").compose("DstOver").out(")", "-composite").writePromise(file3);
|
if (bottomText) await gm().out("-size", size.width).background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${bottomText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}</span>`).out(")", "(", "+clone").out("-channel", "A").out("-morphology", "EdgeOut", "Octagon", "+channel", "+level-colors", "black", ")").compose("DstOver").out(")", "-composite").writePromise(file3);
|
||||||
const data = gm(file).out("-coalesce").out("null:").gravity("North").out(file2).out("-layers", "composite").out("null:").gravity("South").out(bottomText ? file3 : "null:").out("-layers", "composite");
|
const buffer = await gm(file).out("-coalesce").out("null:").gravity("North").out(file2).out("-layers", "composite").out("null:").gravity("South").out(bottomText ? file3 : "null:").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `meme.${image.outputType}`
|
name: `meme.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -10,17 +9,15 @@ exports.run = async (message) => {
|
||||||
const watermark = "./assets/images/memecenter.png";
|
const watermark = "./assets/images/memecenter.png";
|
||||||
let resultBuffer;
|
let resultBuffer;
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const command = gm(image.path).coalesce().background("white").extent(size.width, size.height + 15).out("null:").out(watermark).gravity("SouthEast").compose("over").out("-layers", "composite");
|
const output = await gm(image.path).coalesce().background("white").extent(size.width, size.height + 15).out("null:").out(watermark).gravity("SouthEast").compose("over").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const output = await gmToBuffer(command, image.outputType);
|
|
||||||
const size2 = await gm(output).sizePromise();
|
const size2 = await gm(output).sizePromise();
|
||||||
resultBuffer = output;
|
resultBuffer = output;
|
||||||
if (size.width !== size2.width) {
|
if (size.width !== size2.width) {
|
||||||
const command2 = gm(output).gravity("West").chop(size2.width - size.width, 0);
|
resultBuffer = await gm(output).gravity("West").chop(size2.width - size.width, 0).bufferPromise(image.type);
|
||||||
resultBuffer = await gmToBuffer(command2);
|
|
||||||
}
|
}
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: resultBuffer,
|
file: resultBuffer,
|
||||||
name: `memecenter.${image.outputType}`
|
name: `memecenter.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message, args) => {
|
exports.run = async (message, args) => {
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
|
@ -12,8 +11,7 @@ exports.run = async (message, args) => {
|
||||||
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
|
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
|
||||||
const text = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
|
const text = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
|
||||||
const text2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
|
const text2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
|
||||||
const command = gm().in("(").in(image.path).coalesce().resize(500, 500).borderColor("black").border(5, 5).out(")").borderColor("white").border(3, 3);
|
const buffer = await gm().in("(").in(image.path).coalesce().resize(500, 500).borderColor("black").border(5, 5).out(")").borderColor("white").border(3, 3).bufferPromise("miff");
|
||||||
const buffer = await gmToBuffer(command, "miff");
|
|
||||||
const size = await gm(buffer).sizePromise();
|
const size = await gm(buffer).sizePromise();
|
||||||
await gm(buffer).coalesce().background("black").gravity("Center").extent(600, size.height + 50).writePromise(file);
|
await gm(buffer).coalesce().background("black").gravity("Center").extent(600, size.height + 50).writePromise(file);
|
||||||
const size2 = await gm(file).sizePromise();
|
const size2 = await gm(file).sizePromise();
|
||||||
|
@ -24,15 +22,14 @@ exports.run = async (message, args) => {
|
||||||
if (bottomText) {
|
if (bottomText) {
|
||||||
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText}`).gravity("South").out("-splice", "0x20").writePromise(text2);
|
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText}`).gravity("South").out("-splice", "0x20").writePromise(text2);
|
||||||
const size4 = await gm(text2).sizePromise();
|
const size4 = await gm(text2).sizePromise();
|
||||||
const command3 = gm(await gmToBuffer(command2, image.outputType)).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize");
|
resultBuffer = await gm(await command2.bufferPromise(image.type)).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type);
|
||||||
resultBuffer = await gmToBuffer(command3, image.outputType);
|
|
||||||
} else {
|
} else {
|
||||||
resultBuffer = await gmToBuffer(command2, image.outputType);
|
resultBuffer = await command2.bufferPromise(image.type);
|
||||||
}
|
}
|
||||||
processMessage.delete();
|
processMessage.delete();
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: resultBuffer,
|
file: resultBuffer,
|
||||||
name: `motivate.${image.outputType}`
|
name: `motivate.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to reverse!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to reverse!`;
|
||||||
if (image.type !== "gif" && image.type !== "mp4") return `${message.author.mention}, that isn't a GIF!`;
|
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
|
||||||
const data = gm(image.path).coalesce().out("-reverse");
|
const buffer = await gm(image.path).coalesce().out("-reverse").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: "reverse.gif"
|
name: "reverse.gif"
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(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 Scott the Woz TV meme!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Scott the Woz TV meme!`;
|
||||||
const template = "./assets/images/scott.png";
|
const template = "./assets/images/scott.png";
|
||||||
const command = gm(template).out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("415x234!").out("+distort", "Perspective", "0,0 129,187 415,0 517,182 415,234 517,465 0,234 132,418").out(")").compose("over").gravity("Center").geometry("-238-98").out("-layers", "composite");
|
const buffer = await gm(template).out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("415x234!").out("+distort", "Perspective", "0,0 129,187 415,0 517,182 415,234 517,465 0,234 132,418").out(")").compose("over").gravity("Center").geometry("-238-98").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `scott.${image.outputType}`
|
name: `scott.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`;
|
||||||
const command = gm(image.path).coalesce().sharpen(10);
|
const buffer = await gm(image.path).coalesce().sharpen(10).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `sharpen.${image.outputType}`
|
name: `sharpen.${image.type}`
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`;
|
||||||
const watermark = "./assets/images/shutterstock.png";
|
const watermark = "./assets/images/shutterstock.png";
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
const command = gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, size.height).out("-layers", "composite");
|
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, size.height).out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `shutterstock.${image.outputType}`
|
name: `shutterstock.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
const wrap = require("../utils/wrap.js");
|
const wrap = require("../utils/wrap.js");
|
||||||
|
|
||||||
exports.run = async (message, args) => {
|
exports.run = async (message, args) => {
|
||||||
|
@ -11,8 +10,7 @@ exports.run = async (message, args) => {
|
||||||
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
|
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
|
||||||
const cleanedMessage = args.join(" ").replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'");
|
const cleanedMessage = args.join(" ").replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'");
|
||||||
await gm(474, 332).out("+size").background("none").gravity("Center").out("-pointsize", 72).out("-font", "Bitstream Vera Sans").out(`pango:<span foreground="white">${wrap(cleanedMessage, {width: 15, indent: ""})}</span>`).writePromise(file);
|
await gm(474, 332).out("+size").background("none").gravity("Center").out("-pointsize", 72).out("-font", "Bitstream Vera Sans").out(`pango:<span foreground="white">${wrap(cleanedMessage, {width: 15, indent: ""})}</span>`).writePromise(file);
|
||||||
const command = gm(template).composite(file).gravity("Center").geometry("474x332+160+10");
|
const buffer = await gm(template).composite(file).gravity("Center").geometry("474x332+160+10").bufferPromise("png");
|
||||||
const buffer = await gmToBuffer(command, "png", "sonic");
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: "sonic.png"
|
name: "sonic.png"
|
||||||
|
|
|
@ -5,26 +5,23 @@ const util = require("util");
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to speed up!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to speed up!`;
|
||||||
if (image.type !== "gif" && image.type !== "mp4") return `${message.author.mention}, that isn't a GIF!`;
|
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
|
||||||
const value = await gm(image.path).identifyPromise();
|
const value = await gm(image.path).identifyPromise();
|
||||||
const delay = value.Delay ? value.Delay[0].split("x") : [0, 100];
|
const delay = value.Delay ? value.Delay[0].split("x") : [0, 100];
|
||||||
if (Math.round(parseInt(delay[0]) / 2) >= 2) {
|
if (Math.round(parseInt(delay[0]) / 2) >= 2) {
|
||||||
const data = gm().delay(`${parseInt(delay[0]) / 2}x${delay[1]}`).out(image.path);
|
const buffer = await gm().delay(`${parseInt(delay[0]) / 2}x${delay[1]}`).out(image.path).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: "speed.gif"
|
name: "speed.gif"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const numbers = (await util.promisify(exec)(`seq 0 2 ${value.Scene.length}`)).stdout.split("\n").join(",");
|
const numbers = (await util.promisify(exec)(`seq 0 2 ${value.Scene.length}`)).stdout.split("\n").join(",");
|
||||||
const data = gm().out("(").out(image.path).coalesce().out(")").out("-delete", numbers);
|
const buffer = await gm().out("(").out(image.path).coalesce().out(")").out("-delete", numbers).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: "speed.gif"
|
name: "speed.gif"
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to spin!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to spin!`;
|
||||||
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
||||||
const command = gm(image.path).out("-duplicate", "29").scale("256x256>").scale("256x256<").background("transparent").virtualPixel("background").out("-distort", "SRT", "'%[fx:360*t/n]'").set("delay", "5").set("dispose", "Background").out("-loop", "0");
|
const resultBuffer = await gm(image.path).out("-duplicate", "29").scale("256x256>").scale("256x256<").background("transparent").virtualPixel("background").out("-distort", "SRT", "'%[fx:360*t/n]'").set("delay", "5").set("dispose", "Background").out("-loop", "0").bufferPromise(image.type);
|
||||||
const resultBuffer = await gmToBuffer(command, image.outputType);
|
|
||||||
await processMessage.delete();
|
await processMessage.delete();
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: resultBuffer,
|
file: resultBuffer,
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
|
||||||
const data = gm(image.path).coalesce().resize("512x512!");
|
const buffer = await gm(image.path).coalesce().resize("512x512!").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `stretch.${image.outputType}`
|
name: `stretch.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to swirl!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to swirl!`;
|
||||||
const data = gm(image.path).coalesce().swirl(180);
|
const buffer = await gm(image.path).coalesce().swirl(180).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `swirl.${image.outputType}`
|
name: `swirl.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(message);
|
const image = await require("../utils/imagedetect.js")(message);
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
|
||||||
const output = await gm(image.path).coalesce().command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").streamPromise("miff");
|
const output = await gm(image.path).coalesce().command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").streamPromise("miff");
|
||||||
const data = gm(output).coalesce().resize("800x800>");
|
const buffer = await gm(output).coalesce().resize("800x800>").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `tile.${image.outputType}`
|
name: `tile.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(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 Trump meme!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Trump meme!`;
|
||||||
const template = "./assets/images/trump.png";
|
const template = "./assets/images/trump.png";
|
||||||
const command = gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("365x179!").out("+distort", "Perspective", "0,0 207,268 365,0 548,271 365,179 558,450 0,179 193,450").out(")").compose("over").gravity("Center").geometry("-217-135").out("-layers", "composite");
|
const buffer = await gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("365x179!").out("+distort", "Perspective", "0,0 207,268 365,0 548,271 365,179 558,450 0,179 193,450").out(")").compose("over").gravity("Center").geometry("-217-135").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `trump.${image.outputType}`
|
name: `trump.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -12,11 +11,10 @@ exports.run = async (message) => {
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
await gm(image.path).coalesce().gravity("East").crop("50%", 0).out("+repage").writePromise(data2);
|
await gm(image.path).coalesce().gravity("East").crop("50%", 0).out("+repage").writePromise(data2);
|
||||||
await gm(data2).flop().writePromise(data);
|
await gm(data2).flop().writePromise(data);
|
||||||
const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite");
|
const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `waaw.${image.outputType}`
|
name: `waaw.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(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!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`;
|
||||||
const output = await gm(image.path).coalesce().resize(128).streamPromise("miff");
|
const output = await gm(image.path).coalesce().resize(128).streamPromise("miff");
|
||||||
const data = gm(output).coalesce().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 buffer = await gm(output).coalesce().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").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `wall.${image.outputType}`
|
name: `wall.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
const image = await require("../utils/imagedetect.js")(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 "who did this" meme!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a "who did this" meme!`;
|
||||||
const template = "./assets/images/whodidthis.png";
|
const template = "./assets/images/whodidthis.png";
|
||||||
const command = gm(template).out("null:").out("(").out(image.path).coalesce().out(")").gravity("Center").resize("374x374>").out("-layers", "composite");
|
const buffer = await gm(template).out("null:").out("(").out(image.path).coalesce().out(")").gravity("Center").resize("374x374>").out("-layers", "composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `wdt.${image.outputType}`
|
name: `wdt.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -9,11 +8,10 @@ exports.run = async (message) => {
|
||||||
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
if (size.width > 10000) return `${message.author.mention}, this image is too wide!`;
|
if (size.width > 10000) return `${message.author.mention}, this image is too wide!`;
|
||||||
const data = gm(image.path).coalesce().resize(`${(size.width * 19) / 2}x${size.height / 2}!`);
|
const buffer = await gm(image.path).coalesce().resize(`${(size.width * 19) / 2}x${size.height / 2}!`).bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(data, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `wide.${image.outputType}`
|
name: `wide.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const gm = require("gm").subClass({
|
const gm = require("gm").subClass({
|
||||||
imageMagick: true
|
imageMagick: true
|
||||||
});
|
});
|
||||||
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
||||||
|
|
||||||
exports.run = async (message) => {
|
exports.run = async (message) => {
|
||||||
message.channel.sendTyping();
|
message.channel.sendTyping();
|
||||||
|
@ -12,11 +11,10 @@ exports.run = async (message) => {
|
||||||
const size = await gm(image.path).sizePromise();
|
const size = await gm(image.path).sizePromise();
|
||||||
await gm(image.path).coalesce().gravity("North").crop(0, "50%").out("+repage").writePromise(data2);
|
await gm(image.path).coalesce().gravity("North").crop(0, "50%").out("+repage").writePromise(data2);
|
||||||
await gm(data2).flip().writePromise(data);
|
await gm(data2).flip().writePromise(data);
|
||||||
const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite");
|
const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type);
|
||||||
const buffer = await gmToBuffer(command, image.outputType);
|
|
||||||
return message.channel.createMessage("", {
|
return message.channel.createMessage("", {
|
||||||
file: buffer,
|
file: buffer,
|
||||||
name: `woow.${image.outputType}`
|
name: `woow.${image.type}`
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,23 @@ module.exports = async () => {
|
||||||
gm.prototype.streamPromise = promisify(gm.prototype.stream);
|
gm.prototype.streamPromise = promisify(gm.prototype.stream);
|
||||||
gm.prototype.sizePromise = promisify(gm.prototype.size);
|
gm.prototype.sizePromise = promisify(gm.prototype.size);
|
||||||
gm.prototype.identifyPromise = promisify(gm.prototype.identify);
|
gm.prototype.identifyPromise = promisify(gm.prototype.identify);
|
||||||
|
gm.prototype.bufferPromise = promisify(gm.prototype.toBuffer);
|
||||||
|
/*gm.prototype.bufferPromise = async (format, type) => {
|
||||||
|
console.log(this);
|
||||||
|
const stream = await this.out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").streamPromise(format);
|
||||||
|
const chunks = [];
|
||||||
|
stream.stdout.on("data", (chunk) => {
|
||||||
|
chunks.push(chunk);
|
||||||
|
});
|
||||||
|
// these are 'once' because they can and do fire multiple times for multiple errors,
|
||||||
|
// but this is an async function so you'll have to deal with them one at a time
|
||||||
|
stream.stdout.once("end", () => {
|
||||||
|
return Buffer.concat(chunks);
|
||||||
|
});
|
||||||
|
stream.stderr.once("data", (data) => {
|
||||||
|
data.toString();
|
||||||
|
});
|
||||||
|
};*/
|
||||||
|
|
||||||
// tweet stuff
|
// tweet stuff
|
||||||
if (twitter !== null && twitter.active === false) {
|
if (twitter !== null && twitter.active === false) {
|
||||||
|
|
|
@ -19,9 +19,8 @@ const typeCheck = async (image, gifv = false) => {
|
||||||
const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${imageType.ext}`;
|
const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${imageType.ext}`;
|
||||||
await writeFile(path, imageBuffer);
|
await writeFile(path, imageBuffer);
|
||||||
return {
|
return {
|
||||||
type: imageType.ext,
|
|
||||||
data: imageBuffer,
|
data: imageBuffer,
|
||||||
outputType: imageType.ext === "mp4" ? "gif" : imageType.ext,
|
type: imageType.ext === "mp4" ? "gif" : imageType.ext,
|
||||||
path: path
|
path: path
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
FROM alpine:edge
|
FROM alpine:edge
|
||||||
|
|
||||||
RUN apk --no-cache upgrade && apk add --no-cache chromium && apk add --no-cache squid && apk add --no-cache sudo
|
RUN apk --no-cache upgrade && apk add --no-cache chromium squid sudo
|
||||||
|
|
||||||
ENV ALL_PROXY "http://localhost:3128"
|
ENV ALL_PROXY "http://localhost:3128"
|
||||||
RUN echo -e "\nvisible_hostname esmBot\nforwarded_for delete\nvia off\nfollow_x_forwarded_for deny all \
|
RUN echo -e "\nvisible_hostname esmBot\nforwarded_for delete\nvia off\nfollow_x_forwarded_for deny all \
|
||||||
|
|
Loading…
Reference in a new issue