Image processing module, designed for FrogeBot
$ npm i @frogebot/imageletfrogeImage=require("@frogebot/image")(options);imageMagick (bool, optional) - If set to true, will use ImageMagick instead of GraphicsMagick
maxImageSize (int) - The maximum size for input images
maxGifSize (int) - The maximum size for input GIFs
The exec and execGM functions return image buffers.
// Using JimpawaitfrogeImage.exec(imageUrl,list)// Using GraphicsMagick / ImageMagickawaitfrogeImage.execGM(imageUrl,list)These functions can access any methods in their respective libraries and also certain custom methods.
addBackground: Adds a coloured background and applies size change and image offset.
jpeg: JPEG-ifies image (GraphicsMagick/ImageMagick only)
square: Crops image to square (jimp only)
composite: Uses sharp for compositing images, works both in Jimp and GraphicsMagick/ImageMagick
letimageUrl="https://github.com/FrogeBot/frogeBot/blob/master/assets/icon.png?raw=true"letlist=[["explode",[1.5]],["jpeg",[10]]]fs.write("out.png",awaitfrogeImage.execGM(imageUrl,list),(err)=>{if(err)console.log(err)elseconsole.log("Wrote to out.png")})performMethod,customMethod// Exposes the functions used by exec and execGM to for individual methods on image data.readURL// Reads a URL and returns a parsed gm image.jimpReadURL// Reads a URL and returns a parsed jimp image.readBuffer// Reads an image buffer and returns a parsed jimp image.measureText// Measure text using jimp text.measureTextHeight// Measure text height using jimp text.gmToBuffer// Promisified gm.toBuffer() using url in.getFormat// Promisified gm.format() using url in.loadFont// Load and resolve font using jimp text.