did I really forget to coalesce caption2

This commit is contained in:
Essem 2020-05-23 08:55:18 -05:00 committed by GitHub
parent 6f66799518
commit 9fbb5dfe64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ exports.run = async (message, args) => {
const size = await gm(image.path).sizePromise(); const size = await gm(image.path).sizePromise();
await gm().out("-size", `${size.width - ((size.width / 25) * 2)}x`).background("white").fill("black").font("Helvetica Neue").out("-pointsize", size.width / 17).out(`pango:${newArgs.length !== 0 ? newArgs.join(" ") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" ")}`).gravity("Center").extent(size.width, `%[fx:h+${size.width / 25}]`).writePromise(text); await gm().out("-size", `${size.width - ((size.width / 25) * 2)}x`).background("white").fill("black").font("Helvetica Neue").out("-pointsize", size.width / 17).out(`pango:${newArgs.length !== 0 ? newArgs.join(" ") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" ")}`).gravity("Center").extent(size.width, `%[fx:h+${size.width / 25}]`).writePromise(text);
const size2 = await gm(text).sizePromise(); const size2 = await gm(text).sizePromise();
const outputFinal = await gm(image.path).gravity("North").extent(size.width, size2.height + size.height).out("null:", "(", text, "-set", "page", `+0+${size.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type, image.delay); const outputFinal = await gm(image.path).coalesce().gravity("North").extent(size.width, size2.height + size.height).out("null:", "(", text, "-set", "page", `+0+${size.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type, image.delay);
await processMessage.delete(); await processMessage.delete();
return { return {
file: outputFinal, file: outputFinal,