Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imagemin-webp

Package Overview
Dependencies
Maintainers
6
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagemin-webp

WebP imagemin plugin

  • 8.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
187K
increased by2.59%
Maintainers
6
Weekly downloads
 
Created

What is imagemin-webp?

The imagemin-webp npm package is a plugin for the imagemin image optimization tool that allows you to convert images to the WebP format. WebP is a modern image format that provides superior lossless and lossy compression for images on the web. This package helps in reducing the file size of images while maintaining quality, which can improve website performance.

What are imagemin-webp's main functionalities?

Convert images to WebP format

This feature allows you to convert images from formats like JPEG and PNG to WebP. The code sample demonstrates how to use imagemin-webp to convert all JPEG and PNG images in the 'images' directory to WebP format with a quality setting of 50, and save them in the 'output' directory.

const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');

(async () => {
    await imagemin(['images/*.{jpg,png}'], {
        destination: 'output',
        plugins: [
            imageminWebp({ quality: 50 })
        ]
    });
    console.log('Images converted to WebP format');
})();

Lossless conversion

This feature allows you to convert images to WebP format using lossless compression. The code sample shows how to convert images in the 'images' directory to WebP format with lossless compression and save them in the 'output' directory.

const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');

(async () => {
    await imagemin(['images/*.{jpg,png}'], {
        destination: 'output',
        plugins: [
            imageminWebp({ lossless: true })
        ]
    });
    console.log('Images converted to WebP format with lossless compression');
})();

Resize images during conversion

This feature allows you to resize images while converting them to WebP format. The code sample demonstrates how to resize images to 800x600 pixels during the conversion process and save them in the 'output' directory.

const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');

(async () => {
    await imagemin(['images/*.{jpg,png}'], {
        destination: 'output',
        plugins: [
            imageminWebp({ resize: { width: 800, height: 600 } })
        ]
    });
    console.log('Images resized and converted to WebP format');
})();

Other packages similar to imagemin-webp

Keywords

FAQs

Package last updated on 27 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc