Fixed gifvs not having proper delay

This commit is contained in:
TheEssem 2020-03-15 12:54:51 -05:00
parent 3c831faa20
commit 6dfba281ef
41 changed files with 55 additions and 50 deletions

View File

@ -7,7 +7,7 @@ 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 add a 9GAG watermark!`;
const watermark = "./assets/images/9gag.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("East").out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("East").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `9gag.${image.type}`

View File

@ -7,7 +7,8 @@ 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 add a Bandicam watermark!`;
const watermark = "./assets/images/bandicam.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("North").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type);
console.log(image.delay);
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("North").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `bandicam.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`;
const buffer = await gm(image.path).coalesce().blur(15).bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().blur(15).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `blur.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make blurple!`;
const buffer = await gm(image.path).coalesce().threshold(75, true).out("+level-colors").out("\"#7289DA\",white").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().threshold(75, true).out("+level-colors").out("\"#7289DA\",white").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `blurple.${image.type}`

View File

@ -12,7 +12,7 @@ exports.run = async (message, args) => {
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 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 outputFinal = await gm(output).in("(").gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).out(")").background("white").out("-alpha", "set").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 gm(output).in("(").gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).out(")").background("white").out("-alpha", "set").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, image.delay);
await processMessage.delete();
//return upload(message, outputFinal, `caption.${image.type}`);
return message.channel.createMessage("", {

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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!`;
const buffer = await gm(image.path).coalesce().out("-rotational-blur", 10).bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("-rotational-blur", 10).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `circle.${image.type}`

View File

@ -7,7 +7,7 @@ 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 add a DeviantArt watermark!`;
const watermark = "./assets/images/deviantart.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `deviantart.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to explode!`;
const buffer = await gm(image.path).coalesce().implode([-2]).bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().implode([-2]).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `explode.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to flip!`;
const buffer = await gm(image.path).flip().bufferPromise(image.type);
const buffer = await gm(image.path).flip().bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `flip.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to flop!`;
const buffer = await gm(image.path).flop().bufferPromise(image.type);
const buffer = await gm(image.path).flop().bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `flop.${image.type}`

View File

@ -7,7 +7,7 @@ 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 add New Funky Mode!`;
const watermark = "./assets/images/funky.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthEast").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthEast").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `funky.${image.type}`

View File

@ -7,7 +7,7 @@ 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 GameXplain thumbnail meme!`;
const template = "./assets/images/gamexplain.png";
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 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, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `gamexplain.${image.type}`

View File

@ -8,7 +8,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data);
const buffer = await gm(data).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out("(").out(data).flop().out(")").gravity("East").out("-layers", "Composite").bufferPromise(image.type);
const buffer = await gm(data).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out("(").out(data).flop().out(")").gravity("East").out("-layers", "Composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `haah.${image.type}`

View File

@ -9,8 +9,8 @@ exports.run = async (message) => {
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
const size = await gm(image.path).sizePromise();
await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data);
// const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("North").out("-layers", "Composite").bufferPromise(image.type);
const buffer = await gm(data).extent(size.width, size.height).out("null:").out("(").out(data).flip().out(")").geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type);
// const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("North").out("-layers", "Composite").bufferPromise(image.type, image.delay);
const buffer = await gm(data).extent(size.width, size.height).out("null:").out("(").out(data).flip().out(")").geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `hooh.${image.type}`

View File

@ -7,7 +7,7 @@ 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 add a Hypercam watermark!`;
const watermark = "./assets/images/hypercam.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthWest").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthWest").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `hypercam.${image.type}`

View File

@ -7,7 +7,7 @@ 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 add a iFunny watermark!`;
const watermark = "./assets/images/ifunny.png";
const buffer = await gm(image.path).coalesce().extent("%[fx:u.w]", "%[fx:u.h+(42*min(u.w/1024,u.h/42))]").out("null:").out(watermark).gravity("South").resize("%[fx:u.w]", null).out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().extent("%[fx:u.w]", "%[fx:u.h+(42*min(u.w/1024,u.h/42))]").out("null:").out(watermark).gravity("South").resize("%[fx:u.w]", null).out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `ifunny.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to implode!`;
const buffer = await gm(image.path).implode([1]).bufferPromise(image.type);
const buffer = await gm(image.path).implode([1]).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `implode.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to invert!`;
const buffer = await gm(image.path).coalesce().negative().bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().negative().bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `invert.${image.type}`

View File

@ -8,7 +8,7 @@ exports.run = async (message) => {
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") return `${message.author.mention}, this command doesn't work with GIFs!`;
const template = "./assets/images/leak.png";
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 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, image.delay);
// 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");
return message.channel.createMessage("", {
file: buffer,

View File

@ -7,7 +7,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`;
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 resultBuffer = await gm(image.path).in("(").in("(").coalesce().resize(600, 600).out(")").out("-liquid-rescale", "300x300").out(")").out("-liquid-rescale", "800x800").bufferPromise(image.type);
const resultBuffer = await gm(image.path).in("(").in("(").coalesce().resize(600, 600).out(")").out("-liquid-rescale", "300x300").out(")").out("-liquid-rescale", "800x800").bufferPromise(image.type, image.delay);
await processMessage.delete();
return message.channel.createMessage("", {
file: resultBuffer,

View File

@ -14,7 +14,7 @@ exports.run = async (message, args) => {
await gm(image.path).coalesce().resize(600, 600).noProfile().writePromise(file);
await gm(file).out("-size", "%[fx:u.w]").out("-delete", "0--1").background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${topText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;")}</span>`).out(")", "(", "+clone").out("-alpha", "extract").out("-morphology", "EdgeOut", "Octagon", "-background", "black", "-alpha", "shape", ")").compose("DstOver").out(")", "-composite").writePromise(file2);
if (bottomText) await gm(file).out("-size", "%[fx:u.w]").out("-delete", "0--1").background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${bottomText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;")}</span>`).out(")", "(", "+clone").out("-alpha", "extract").out("-morphology", "EdgeOut", "Octagon", "-background", "black", "-alpha", "shape", ")").compose("DstOver").out(")", "-composite").writePromise(file3);
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 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, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `meme.${image.type}`

View File

@ -7,7 +7,7 @@ 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 add a MemeCenter watermark!`;
const watermark = "./assets/images/memecenter.png";
const output = await gm(image.path).coalesce().background("white").extent("%[fx:u.w]", "%[fx:u.h+15]").out("null:").out(watermark).gravity("SouthEast").compose("over").out("-layers", "composite").bufferPromise(image.type);
const output = await gm(image.path).coalesce().background("white").extent("%[fx:u.w]", "%[fx:u.h+15]").out("null:").out(watermark).gravity("SouthEast").compose("over").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: output,
name: `memecenter.${image.type}`

View File

@ -11,8 +11,8 @@ exports.run = async (message, args) => {
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
const text = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
const text2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
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");
await gm(buffer).coalesce().background("black").gravity("Center").extent(600, "%[fx:s.h+50]").writePromise(file);
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", image.delay);
await gm(buffer).coalesce().gravity("Center").extent(600, "%[fx:s.h+50]").writePromise(file);
const size2 = await gm(file).sizePromise();
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;")}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
const size3 = await gm(text).sizePromise();
@ -21,9 +21,9 @@ exports.run = async (message, args) => {
if (bottomText) {
await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(28).gravity("Center").out(`pango:${bottomText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;")}`).gravity("South").out("-splice", "0x20").writePromise(text2);
const size4 = await gm(text2).sizePromise();
resultBuffer = await gm(await command2.bufferPromise(image.type)).gravity("North").coalesce().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 gm(await command2.bufferPromise(image.type, image.delay)).gravity("North").coalesce().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, image.delay);
} else {
resultBuffer = await command2.bufferPromise(image.type);
resultBuffer = await command2.bufferPromise(image.type, image.delay);
}
processMessage.delete();
return message.channel.createMessage("", {

View File

@ -7,7 +7,7 @@ exports.run = async (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.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await gm(image.path).coalesce().out("-reverse").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("-reverse").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: "reverse.gif"

View File

@ -7,7 +7,7 @@ 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 Scott the Woz TV meme!`;
const template = "./assets/images/scott.png";
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 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, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `scott.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`;
const buffer = await gm(image.path).coalesce().sharpen(10).bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().sharpen(10).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `sharpen.${image.type}`

View File

@ -7,7 +7,7 @@ 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 add a Shutterstock watermark!`;
const watermark = "./assets/images/shutterstock.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").resize(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `shutterstock.${image.type}`

View File

@ -10,7 +10,7 @@ exports.run = async (message, args) => {
const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`;
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;");
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 buffer = await gm(template).composite(file).gravity("Center").geometry("474x332+160+10").bufferPromise("png", "sonic");
const buffer = await gm(template).composite(file).gravity("Center").geometry("474x332+160+10").bufferPromise("png", null, "sonic");
return message.channel.createMessage("", {
file: buffer,
name: "sonic.png"

View File

@ -14,14 +14,14 @@ exports.run = async (message) => {
const value = await gm(image.path).identifyPromise();
const delay = value.Delay ? value.Delay[0].split("x") : [0, 100];
if (Math.round(parseInt(delay[0]) / 2) >= 2) {
const buffer = await gm().delay(`${parseInt(delay[0]) / 2}x${delay[1]}`).out(image.path).bufferPromise(image.type);
const buffer = await gm().delay(`${parseInt(delay[0]) / 2}x${delay[1]}`).out(image.path).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: "speed.gif"
});
} else {
const numbers = (await util.promisify(exec)(`seq 0 2 ${value.Scene.length}`)).stdout.split("\n").join(",");
const buffer = await gm().out("(").out(image.path).coalesce().out(")").out("-delete", numbers).bufferPromise(image.type);
const buffer = await gm().out("(").out(image.path).coalesce().out(")").out("-delete", numbers).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: "speed.gif"

View File

@ -6,7 +6,7 @@ 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 spin!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
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 gm(image.path).coalesce().out("-duplicate", "29").scale("256x256>").scale("256x256<").background("white").virtualPixel("background").out("-rotate", "%[fx:360*t/n]").set("delay", "5").set("dispose", "background").out("-loop", "0").bufferPromise("gif");
await processMessage.delete();
return message.channel.createMessage("", {
file: resultBuffer,

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
const buffer = await gm(image.path).coalesce().resize("512x512!").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().resize("512x512!").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `stretch.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to swirl!`;
const buffer = await gm(image.path).coalesce().swirl(180).bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().swirl(180).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `swirl.${image.type}`

View File

@ -7,7 +7,7 @@ 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 tile!`;
const output = await gm(image.path).coalesce().command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").streamPromise("miff");
const buffer = await gm(output).coalesce().resize("800x800>").bufferPromise(image.type);
const buffer = await gm(output).coalesce().resize("800x800>").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `tile.${image.type}`

View File

@ -7,7 +7,7 @@ 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 Trump meme!`;
const template = "./assets/images/trump.png";
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 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, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `trump.${image.type}`

View File

@ -11,8 +11,8 @@ exports.run = async (message) => {
const size = await gm(image.path).sizePromise();
await gm(image.path).coalesce().gravity("East").crop("50%", 0).out("+repage").writePromise(data2);
await gm(data2).flop().writePromise(data);
// const buffer = await gm(data2).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out(data).gravity("West").out("-layers", "Composite").bufferPromise(image.type);
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 gm(data2).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out(data).gravity("West").out("-layers", "Composite").bufferPromise(image.type, image.delay);
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, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `waaw.${image.type}`

View File

@ -7,7 +7,7 @@ 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!`;
const output = await gm(image.path).coalesce().resize(128).streamPromise("miff");
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 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, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `wall.${image.type}`

View File

@ -7,7 +7,7 @@ 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 "who did this" meme!`;
const template = "./assets/images/whodidthis.png";
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 gm(template).out("null:").out("(").out(image.path).coalesce().out(")").gravity("Center").resize("374x374>").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `wdt.${image.type}`

View File

@ -6,7 +6,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
const buffer = await gm(image.path).coalesce().resize("%[fx:(u.w*19)/2]x%[fx:u.h/2]!").bufferPromise(image.type);
const buffer = await gm(image.path).coalesce().resize("%[fx:(u.w*19)/2]x%[fx:u.h/2]!").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `wide.${image.type}`

View File

@ -10,7 +10,7 @@ exports.run = async (message) => {
const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
await gm(image.path).coalesce().gravity("North").crop(0, "50%").out("+repage").writePromise(data2);
await gm(data2).flip().writePromise(data);
const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("South").out("-layers", "Composite").bufferPromise(image.type);
const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("South").out("-layers", "Composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
file: buffer,
name: `woow.${image.type}`

View File

@ -50,10 +50,10 @@ module.exports = async () => {
gm.prototype.sizePromise = promisify(gm.prototype.size);
gm.prototype.identifyPromise = promisify(gm.prototype.identify);
//gm.prototype.bufferPromise = promisify(gm.prototype.toBuffer);
gm.prototype.bufferPromise = function(format, type) {
gm.prototype.bufferPromise = function(format, delay, type) {
return new Promise((resolve, reject) => {
if (format) {
this.out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").stream(format, (err, stdout, stderr) => {
this.in(delay ? "-delay" : "", delay ? delay.split("/").reverse().join("x") : "").out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").out("-limit", "memory", "64MB").out("-limit", "map", "128MB").stream(format, (err, stdout, stderr) => {
if (err) return reject(err);
const chunks = [];
stdout.on("data", (chunk) => {
@ -69,7 +69,7 @@ module.exports = async () => {
});
});
} else {
this.out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").stream((err, stdout, stderr) => {
this.in(delay ? "-delay" : "", delay ? delay.split("/").reverse().join("x") : "").out(type !== "sonic" ? "-layers" : "", type !== "sonic" ? "optimize" : "").out("-limit", "memory", "64MB").out("-limit", "map", "128MB").stream((err, stdout, stderr) => {
if (err) return reject(err);
const chunks = [];
stdout.on("data", (chunk) => {

View File

@ -1,6 +1,8 @@
const fetch = require("node-fetch");
const fileType = require("file-type");
const writeFile = require("util").promisify(require("fs").writeFile);
const { promisify } = require("util");
const writeFile = promisify(require("fs").writeFile);
const execPromise = promisify(require("child_process").exec);
const urlRegex = /(?:\w+:)?\/\/(\S+)/;
// this checks if the file is, in fact, an image
@ -18,11 +20,13 @@ const typeCheck = async (image, gifv = false) => {
// if it is, then return the url with the file type
const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${imageType.ext}`;
await writeFile(path, imageBuffer);
return {
const payload = {
data: imageBuffer,
type: imageType.ext !== "mp4" ? (imageType.ext === "jpg" ? "jpeg" : imageType.ext) : "gif",
path: path
};
if (gifv) payload.delay = (await execPromise(`ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate ${path}`)).stdout.replace("\n", "");
return payload;
} else {
// if not, then return false
return false;