From c34505ea3386e756aefb96dcc4dfeb64122cc545 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 11 May 2026 21:47:35 +0700 Subject: [PATCH] docs(readme): correct to HTTP microservice, add usage, output formats, related link --- webp-converter/README.md | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/webp-converter/README.md b/webp-converter/README.md index d5aa159..93e406b 100644 --- a/webp-converter/README.md +++ b/webp-converter/README.md @@ -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).