discord-canvas icon indicating copy to clipboard operation
discord-canvas copied to clipboard

Image size in fortniteShop()

Open manelcomiche opened this issue 3 years ago • 1 comments

The size of the generated image is larger than 8mb and discord cannot process it.

manelcomiche avatar Dec 25 '21 17:12 manelcomiche

Is there a way to optimize the image before it gets posted ? Seen a npm packages (tinify) BUT since the image name keeps changing.

Yes tinify does the trick.

const tinify = require("tinify"); tinify.key = APIKEYS.Tinify;

await tinify.fromFile(image).toFile(image);

The image is the path to the file and after that it's creating the MessageAttachment.

OfficialRDB avatar Feb 14 '22 06:02 OfficialRDB