## ClownFish / image2webp .gitee-modal { width: 500px !important; }

Explore and code with more than 8 million developers，Free private repositories ！：）
ClownFish 0c9e548
Notice: Creating folder will generate an empty file .keep, because not support in Git

## Introduce

The Image2webp project is an application written with golang that supports real-time transcoding of multiple image formats into webp images.

Currently support JPG, JPEG, PNG, BMP, GIF these formats into Webp format.

'Webp' format can significantly reduce the size of the picture without affecting the picture quality, so as to improve the speed of network transmission, save bandwidth traffic resources.

This project also supports webp format thumbnail function, is also real-time transcoding, can be configured to the existing server without invasion, only need to do some forwarding in nginx, do not change any other logic.

## Best practice

The best realization of this project is to start this service in the picture server and configure forwarding in nginx or other web servers, Just match the url format ^(.+)_webp(_(\d+)_(\d+)(.*))? to forward to the image2webp program and output the webp image.

If it is the front end to access the picture, when the request volume is large, this real-time transcoding method will cause CPU performance, so for the large request volume, please see, before you must use the CDN file.

Set the CDN image cache expiration date a little longer, the service is only used back to the source, that is perfect.

## Compile

Compilation is very simple, make sure your go version is 1.15 and above, and turn on support for mod.

Execute the make command and it will compile automatically. Of course, you can also manually execute the full path compiler command.

$go build -v -o image2webp After compiling successfully, you can execute $ ./image2webp start --config=./config.json

To start it.

## Configuration

config.json Is in json format.

• storagePath The directory where images are stored
• quality Image quality when transcoding to webp. The default percentage is 80%
• allowSizes Supported thumbnail format. _50_50: _width_height

## Deploy

image2webp deployment is also very convenient, just need to put the compiled binaries directly on the server to run, Then configure the front - end proxy, you can refer to nginx.conf.

## Thanks

• This project is based on the DMicro framework.
• This project is based on the Go Frame framework.
• Refer to the project webp_server_go
• Thank you for providing a variety of image conversion library project, you can see the source library reference.

### Repository Comments ( 0 )

Image2webp项目是使用golang编写的支持多种图片格式实时转码成Webp格式的图片的应用程序。目前支持JPG,JPEG, PNG, BMP, GIF 这些格式转码成Webp格式 expand collapse
Go and 3 more languages
Apache-2.0

No release