直接用二进制运行可能遇到 glibc 和依赖库问题,官方推荐用 Docker;需要把图片目录、exhaust 缓存目录和 metadata 目录分别挂载到容器的 /opt/pics、/opt/exhaust、/opt/metadata;默认监听 3333 端口,对外访问需自行配置 Nginx 等反向代理。

webp_server_go
webp-shGPL-3.0活跃维护用 Go 写的图片转换服务,把 JPG/PNG/BMP/SVG 实时转成 WebP/AVIF 并压缩,帮网站省带宽、提加载速度。
Go version of WebP Server. A tool that will serve your JPG/PNG/BMP/SVGs as WebP/AVIF format with compression, on-the-fly.
docker-compose up -dREADME 未说明具体硬件要求,只说明可用 Docker 运行;直接跑二进制可能遇到 glibc 和依赖库问题,因此推荐用 Docker。
用 Go 写的图片转换服务,访问原图 URL 时实时返回压缩后的 WebP/AVIF
用 Go 写的图片转换服务,把 JPG/PNG/BMP/SVG 实时转成 WebP/AVIF 并压缩,帮网站省带宽、提加载速度。
核心能力
- 按原 URL 实时把 JPG/PNG/BMP/SVG 等转成 WebP/AVIF
- 支持 JPEG、PNG、BMP、GIF、SVG、HEIC、NEF、WEBP 输入
- 用 exhaust 目录缓存转换结果,用 metadata 目录做缓存校验
- GIF 不转 AVIF,因为转换后动画会丢失
- 可挂载自定义 config.json 调整配置与 AVIF 支持
容易踩的坑
- 0.16.2WebP Server Go 0.16.2最新正式版2026-10-06 · 2026-10-06 13:05 UTC
What's Changed
- Bump golang.org/x/image from 0.45.0 to 0.46.0 by @dependabot[bot] in https://github.com/webp-sh/webp_server_go/pull/472
- Fix prefix on ImageMap by @n0vad3v in https://github.com/webp-sh/webp_server_go/pull/474
Full Changelog: https://github.com/webp-sh/webp_server_go/compare/0.16.1...0.16.2
- 0.16.1WebP Server Go 0.16.12026-09-21 · 2026-09-21 01:20 UTC
查看更新说明
What's Changed
- bump to go vips 2.19 by @n0vad3v in https://github.com/webp-sh/webp_server_go/pull/473
Full Changelog: https://github.com/webp-sh/webp_server_go/compare/0.16.0...0.16.1
- 0.16.0WebP Server Go 0.16.02026-08-27 · 2026-08-27 04:50 UTC
查看更新说明
What's Changed
- Add Vary header, remove UA detection by @n0vad3v in https://github.com/webp-sh/webp_server_go/pull/469, now WebP Server Go works better with CDN cache, see docs: https://docs.webp.sh/deployment/cdn/ for more information on this.
Full Changelog: https://github.com/webp-sh/webp_server_go/compare/0.15.2...0.16.0
- 0.15.2WebP Server Go 0.15.22026-08-22 · 2026-08-22 03:26 UTC
查看更新说明
What's Changed
- Bump to use Go 1.27 with a small modernization pass (WaitGroup.Go, WalkDir, and a file-handle leak fix) and routine dependency updates.
Full Changelog: https://github.com/webp-sh/webp_server_go/compare/0.15.1...0.15.2
- 0.15.1WebP Server Go 0.15.12026-06-09 · 2026-06-09 01:39 UTC
查看更新说明
What's Changed
- Add scenarios testflow by @n0vad3v in https://github.com/webp-sh/webp_server_go/pull/452
- fix metadata logic by @n0vad3v in https://github.com/webp-sh/webp_server_go/pull/454
Full Changelog: https://github.com/webp-sh/webp_server_go/compare/0.15.0...0.15.1
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Documentation | Website | Blog
This is a Server based on Golang, which allows you to serve WebP images on the fly.
Currently supported image format: JPEG, PNG, BMP, GIF, SVG, HEIC, NEF, WEBP
e.g When you visit
https://your.website/pics/tsuki.jpg,it will serve asimage/webp/image/avifformat without changing the URL.GIF image will not be converted to AVIF format because the converted AVIF image is not animated.
Usage with Docker(recommended)
We strongly recommend using Docker to run WebP Server Go because running it directly with the binary may encounter issues with glibc and some dependency libraries, which can be quite tricky to resolve.
flowchart LR
client["Client\nGET /some-images/tsuki.jpg"] --> server["WebP Server Go\n:3333"]
subgraph host["Host machine"]
hostPics["/path/to/pics"]
hostExhaust["./exhaust"]
hostMeta["./metadata"]
end
subgraph container["Docker container"]
cPics["/opt/pics (source images)"]
cExhaust["/opt/exhaust (optimized cache)"]
cMeta["/opt/metadata (source metadata)"]
end
hostPics <-- "volume mount" --> cPics
hostExhaust <-- "volume mount" --> cExhaust
hostMeta <-- "volume mount" --> cMeta
server --> cPics
server --> cExhaust
server --> cMeta
server --> response["Return optimized image\n(webp/avif/jxl)"]
This helps separate responsibilities clearly:
picsstores original files,exhauststores converted outputs, andmetadatastores source metadata used for cache validation.
Make sure you've got Docker and docker-compose installed, create a directory and create docker-compose.yml file inside it like this:
version: '3'
services:
webp:
image: webpsh/webp-server-go
# image: ghcr.io/webp-sh/webp_server_go
restart: always
volumes:
- ./path/to/pics:/opt/pics
- ./exhaust:/opt/exhaust
- ./metadata:/opt/metadata
ports:
- 127.0.0.1:3333:3333
Suppose your website and image has the following pattern.
| Image Path | Website Path |
|---|---|
/var/www/img.webp.sh/path/tsuki.jpg | https://img.webp.sh/path/tsuki.jpg |
Then
./path/to/picsshould be changed to/var/www/img.webp.sh./exhaustis cache folder for output images, by default it will be inexhaustdirectory alongside withdocker-compose.ymlfile, if you'd like to keep cached images in another folder, you can change./exhaustto/some/other/path/to/exhaust./metadatais cache folder for images' metadata, by default it will be inmetadatadirectory alongside withdocker-compose.ymlfile
Start the container using:
docker-compose up -d
Now the server should be running on 127.0.0.1:3333, visiting http://127.0.0.1:3333/path/tsuki.jpg will see the optimized version of /var/www/img.webp.sh/path/tsuki.jpg, you can now add reverse proxy to make it public, for example, let Nginx to proxy_pass http://127.0.0.1:3333/;, and your WebP Server is on-the-fly!
Custom config
If you'd like to use a customized config.json, you can follow the steps in Configuration | WebP Server Documentation to genereate one, and mount it into the container's /etc/config.json, example docker-compose.yml as follows:
version: '3'
services:
webp:
image: webpsh/webp-server-go
# image: ghcr.io/webp-sh/webp_server_go
restart: always
volumes:
- ./path/to/pics:/opt/pics
- ./path/to/exhaust:/opt/exhaust
- ./path/to/metadata:/opt/metadata
- ./config.json:/etc/config.json
ports:
- 127.0.0.1:3333:3333
You can refer to Configuration | WebP Server Documentation for more info, such as custom config, AVIF support etc.
Or, if you need some examples, you can refer to Configuration Examples | WebP Server Documentation.
Advanced Usage
If you'd like to use with binary, please consult to Use with Binary(Advanced) | WebP Server Documentation
spoiler alert: you may encounter issues with
glibcand some dependency libraries.
For supervisor or detailed Nginx configuration, please read our documentation at https://docs.webp.sh/
WebP Cloud Services
We are currently building a new service called WebP Cloud Services, it now has three parts:
- Public Service
- GitHub Avatar/Gravater reverse proxy with WebP optimization, for example, change
https://www.gravatar.com/avatar/09eba3a443a7ea91cf818f6b27607d66tohttps://gravatar.webp.se/avatar/09eba3a443a7ea91cf818f6b27607d66for rendering will get a smaller version of gravater, making your website faster - Totally free service and currently has a large number of users, this includes, but is not limited to CNX Software, Indienova
- GitHub Avatar/Gravater reverse proxy with WebP optimization, for example, change
- WebP Cloud
- No need to install WebP Server Go yourself, especially suitable for static websites.
- Image Conversion: WebP Cloud converts images to WebP/AVIF format, reducing size while maintaining quality for faster website loading.
- Example 1: Original image URL (https://yyets.dmesg.app/api/user/avatar/BennyThink) becomes compressed URL (https://vz4w427.webp.ee/api/user/avatar/Benny).
- Example 2: Original image URL (https://yyets.dmesg.app/api/user/avatar/BennyThink) becomes a thumbnail image using URL (https://vz4w427.webp.ee/api/user/avatar/BennyThink?width=200).
- Caching: WebP Cloud automatically caches served images, reducing traffic and bandwidth load on the origin server.
- Fly
- We call this service Fly, with the aim of providing a public and free service that users can experience without registering on WebP Cloud.
As this is a public service, some limitations compared to WebP Cloud are imposed:
- Fly supports a maximum original image size of 8MB, while WebP Cloud supports up to 80MB.
- Fly cache time is 1 day, while WebP Cloud has unlimited time (can be manually cleared at any time).
- It does not support parameters like
blur,sharpenfor image processing. - And that’s it.
- We call this service Fly, with the aim of providing a public and free service that users can experience without registering on WebP Cloud.
As this is a public service, some limitations compared to WebP Cloud are imposed:
For detailed information, please visit WebP Cloud Services Website or WebP Cloud Services Docs. |
License
WebP Server is under the GPLv3. See the LICENSE file for details.
Security
Please refer to SECURITY.md for more information.