imgi is an image procressing service.
You can install imgi from docker or build from source.
- GO 1.14+
- libvips 8.9+
go get -u github.com/imgi/imgi/cmd/imgi
Start imgi container with default configuration:
docker run -d -p 6969:6969 -v /path/to/images:/images imgi/imgi
Start imgi server with a custom configuration file:
imgi -c imgi.conf
Resize an image:
http://localhost:6969/images/image.jpg?imgi=resize:w_640,h_480,m_fit
API is access by providing an http query string imgi
with the following format:
imgi=operation0:option0_value0,option1_value1|operation1:option0_value0
Option | Type | Value | Description |
---|---|---|---|
m | string | fit, fill, flex default: fit |
content mode: fit : aspect ratio preserved, width and height attain fill : aspect ratio ignored, width and height attain flex : aspect ratio preserved, width or height attain |
w | int | [1, 10000] |
output image width |
h | int | [1, 10000] |
output image height |
Option | Type | Value | Description |
---|---|---|---|
w | int | [1, width - x] |
output image width |
h | int | [1, height - y] |
output image height |
x | int | [0, width] |
x-axis along image width |
y | int | [0, height] |
y-axis along image height |
MIT - Copyright (c) 2020 Chen Guohui