Skip to content

buddypia/image-to-webp

Repository files navigation

image-to-webp

provides a API to convert image(JPG, PNG) -> WEBP

WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.

The purpose of this repository is a project to convert image files to the next generation image format (webp).

Support

support

Installation

For Docker

  1. git clone
git clone [email protected]:shoridevel/image-to-webp.git
  1. docker build
docker build ./ -t image-to-webp
  1. docker run
docker run -d -p 3001:3001 --name image-to-webp image-to-webp
  1. Check with cURL
curl -v "http://localhost:3001" -X POST -F [email protected] -o image.webp

For Mac

  1. install & download download See also - cwebp

  2. Add cwebp path

export PATH="$PATH:/<Set your path>/libwebp-1.2.1-mac-10.15/bin"
  1. node package install
yarn install
  1. run

For development

yarn dev

For Production

yarn start

Usage

Check the details with API

http://localhost:3001/api-docs

option params

q=50(quality 1~100, Optional pamameter)

You can reduce the size of the image file by specifying the image quality.

curl "localhost:3001/" -X POST -F [email protected] -F q=75 -o image.webp

or just simply call:

curl "localhost:3001/" -X POST -F [email protected] -o image.webp

Before(1.6MB) → Reduced image size by -77%

thomas-chan-a3wiRpcBmgY-unsplash.jpg

After(330KB)

thomas-chan-a3wiRpcBmgY-unsplash.webp

Before(2.3MB) → Reduced image size by -84%

lubo-minar-j2RgHfqKhCM-unsplash.jpg

After(1MB)

lubo-minar-j2RgHfqKhCM-unsplash.webp

About

provides a API to convert image(JPG, PNG) -> WEBP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published