diff --git a/commands/bandicam.js b/commands/bandicam.js index 184306ee..840f9217 100644 --- a/commands/bandicam.js +++ b/commands/bandicam.js @@ -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 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, image.delay); + const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("North").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay); return message.channel.createMessage("", { file: buffer, name: `bandicam.${image.type}` diff --git a/commands/deviantart.js b/commands/deviantart.js index 85d27357..f065c00e 100644 --- a/commands/deviantart.js +++ b/commands/deviantart.js @@ -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, image.delay); + const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay); return message.channel.createMessage("", { file: buffer, name: `deviantart.${image.type}` diff --git a/commands/funky.js b/commands/funky.js index 1c6211b7..c50c8769 100644 --- a/commands/funky.js +++ b/commands/funky.js @@ -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, image.delay); + const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthEast").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay); return message.channel.createMessage("", { file: buffer, name: `funky.${image.type}` diff --git a/commands/gamexplain.js b/commands/gamexplain.js index 73dde1fb..32aca07f 100644 --- a/commands/gamexplain.js +++ b/commands/gamexplain.js @@ -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, image.delay); + const buffer = await gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").scale("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}` diff --git a/commands/hypercam.js b/commands/hypercam.js index a24376dd..b8aa2572 100644 --- a/commands/hypercam.js +++ b/commands/hypercam.js @@ -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, image.delay); + const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthWest").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay); return message.channel.createMessage("", { file: buffer, name: `hypercam.${image.type}` diff --git a/commands/ifunny.js b/commands/ifunny.js index 9552184b..b6b604d7 100644 --- a/commands/ifunny.js +++ b/commands/ifunny.js @@ -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, image.delay); + 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").scale("%[fx:u.w]", null).out("-layers", "composite").bufferPromise(image.type, image.delay); return message.channel.createMessage("", { file: buffer, name: `ifunny.${image.type}` diff --git a/commands/jpeg.js b/commands/jpeg.js index 4bc16d45..c505247e 100644 --- a/commands/jpeg.js +++ b/commands/jpeg.js @@ -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 more JPEG!`; - const buffer = await gm(image.path).setFormat("jpeg").quality(1).bufferPromise(); + const buffer = await gm(`${image.path}[0]`).quality(1).bufferPromise("jpg"); return message.channel.createMessage("", { file: buffer, name: "jpeg.jpg" diff --git a/commands/magik.js b/commands/magik.js index d245cdf5..52b786fd 100644 --- a/commands/magik.js +++ b/commands/magik.js @@ -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(" 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, image.delay); + const resultBuffer = await gm(image.path).in("(").in("(").coalesce().scale(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, diff --git a/commands/meme.js b/commands/meme.js index 1fa92070..28f6f995 100644 --- a/commands/meme.js +++ b/commands/meme.js @@ -11,7 +11,7 @@ exports.run = async (message, args) => { const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`; const file2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`; const file3 = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`; - await gm(image.path).coalesce().resize(600, 600).noProfile().writePromise(file); + await gm(image.path).coalesce().scale(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:${topText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/`).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:${bottomText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/`).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, image.delay); diff --git a/commands/motivate.js b/commands/motivate.js index bc2fa14e..cba65dbd 100644 --- a/commands/motivate.js +++ b/commands/motivate.js @@ -11,7 +11,7 @@ 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", image.delay); + const buffer = await gm().in("(").in(image.path).coalesce().scale(500, 500).borderColor("black").border(5, 5).out(")").borderColor("white").border(3, 3).bufferPromise("miff", image.delay); await gm(buffer).coalesce().background("black").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, "\\&").replace(/>/g, "\\>").replace(/ { 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, image.delay); + const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay); return message.channel.createMessage("", { file: buffer, name: `shutterstock.${image.type}`