docs(readme): correct to HTTP microservice, add usage, output formats, related link

This commit is contained in:
2026-05-11 21:47:35 +07:00
parent 674c400b55
commit c34505ea33
+29 -10
View File
@@ -1,28 +1,47 @@
# webp-converter
CLI tool written in Go to convert WebP images to other formats (PNG, JPG, etc.).
Lightweight HTTP microservice written in Go that converts WebP images to PNG on-the-fly — accepts an image URL, returns the converted PNG bytes.
## Quick start
```bash
go install github.com/tiennm99/webp-converter@latest
webp-converter -input image.webp -output image.png
```
Or build from source:
```bash
go build -o webp-converter .
./webp-converter -input image.webp -output image.png
./webp-converter
# Server listens on :8080
```
Docker:
```bash
docker build -t webp-converter .
docker run --rm -v $(pwd):/data webp-converter -input /data/image.webp -output /data/image.png
docker run --rm -p 8080:8080 webp-converter
```
## Usage
POST a JSON body with the source image URL to `/process`:
```bash
curl -X POST http://localhost:8080/process \
-H "Content-Type: application/json" \
-d '{"img": "https://example.com/image.webp"}' \
--output image.png
```
- If the URL points to a **WebP** image, the response is the converted **PNG**.
- If the URL points to any other format, the original image bytes are returned unchanged (pass-through).
## Output formats
| Input | Output |
|-------|--------|
| WebP | PNG |
| Any other format | Original (pass-through) |
## Related
- [image-resizer](https://github.com/tiennm99/image-resizer) — batch-resize images by percentage (same domain, different operation).
## License
Apache-2.0 — see [LICENSE](LICENSE).