Path to the source image or image buffer
Target format to convert to
Additional conversion options
Converted image as buffer
const { convertImage, ImageFormat } = require("kiutils");
// Convert from file path
convertImage("image.png", ImageFormat.WEBP)
.then(buffer => fs.writeFileSync("image.webp", buffer));
// Convert from buffer with options
const inputBuffer = fs.readFileSync("image.jpg");
convertImage(inputBuffer, ImageFormat.PNG, { width: 800 })
.then(buffer => fs.writeFileSync("resized.png", buffer));
Generated using TypeDoc
Converts an image from one format to another using Sharp