Compresses an image to the specified format.
Automatically selects the fastest available engine:
ffmpeg
const { blob, ratio } = await compressImage(file, { format: 'webp', quality: 0.8 });console.log(`Compressed to ${(ratio * 100).toFixed(0)}% of original size`); Copy
const { blob, ratio } = await compressImage(file, { format: 'webp', quality: 0.8 });console.log(`Compressed to ${(ratio * 100).toFixed(0)}% of original size`);
Compresses an image to the specified format.
Automatically selects the fastest available engine:
ffmpegbinary via child_process