Replace many instances of resize with scale
This commit is contained in:
parent
628a002205
commit
71a4ca7b22
11 changed files with 11 additions and 11 deletions
|
@ -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}`
|
||||
|
|
|
@ -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}`
|
||||
|
|
|
@ -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}`
|
||||
|
|
|
@ -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}`
|
||||
|
|
|
@ -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}`
|
||||
|
|
|
@ -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}`
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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, 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,
|
||||
|
|
|
@ -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:<span foreground='white'>${topText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}</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, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}</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, image.delay);
|
||||
|
|
|
@ -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(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'")}`).gravity("South").out("-splice", bottomText ? "0x0" : "0x20").writePromise(text);
|
||||
|
|
|
@ -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, 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}`
|
||||
|
|
Loading…
Reference in a new issue