mirror of
https://github.com/tiennm99/MTTools.git
synced 2026-10-11 12:19:09 +00:00
docs(readme): add formats table, aspect-ratio note, example, related link
This commit is contained in:
1 parent
0f2468a467
commit
8e22bfcbcf
1 file changed
+41
-3
+41
-3
@@ -1,6 +1,6 @@
|
|||||||
# image-resizer
|
# image-resizer
|
||||||
|
|
||||||
Lightweight image resizing CLI written in Go.
|
Lightweight image batch-resizer written in Go — scales images to a percentage of their original size while preserving aspect ratio.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
@@ -10,10 +10,48 @@ go build -o image-resizer
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Edit the `main()` function in `main.go` to set your source folder and scale percentage, then run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./image-resizer <input> <output> <width> <height>
|
go run main.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Example — resize all images in a folder to 50%:
|
||||||
|
|
||||||
|
```go
|
||||||
|
folderPath := "/path/to/images"
|
||||||
|
scalePercent := 50 // 50% of original dimensions
|
||||||
|
overwrite := true // overwrite originals; false saves to output folder
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
```
|
||||||
|
Image Resizer - Scaling to 50%
|
||||||
|
Source folder: /path/to/images
|
||||||
|
Mode: Overwriting original images
|
||||||
|
--------------------------------------------------
|
||||||
|
Resized: banner.png -> banner.png
|
||||||
|
Resized: icon.jpg -> icon.jpg
|
||||||
|
--------------------------------------------------
|
||||||
|
Done!
|
||||||
|
```
|
||||||
|
|
||||||
|
## Supported formats
|
||||||
|
|
||||||
|
| Input | Output |
|
||||||
|
|-------|--------|
|
||||||
|
| JPEG / JPG | JPEG (quality 95) |
|
||||||
|
| PNG | PNG |
|
||||||
|
| GIF | JPEG (quality 95) |
|
||||||
|
| BMP | BMP |
|
||||||
|
| TIFF / TIF | TIFF |
|
||||||
|
|
||||||
|
Aspect ratio is always preserved — the scale percentage applies uniformly to both width and height.
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [webp-converter](https://github.com/tiennm99/webp-converter) — converts WebP images to PNG/JPG (same domain, different operation).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Apache-2.0
|
Apache-2.0 — see [LICENSE](LICENSE).
|
||||||
Reference in new issue
Block a user