image-server is a simple http server that accepts an image, converts it to a different format, resizes/compresses it and sends it back.
$ docker pull kkty/image-server
$ docker run -d -p 8080:8080 kkty/image-server
$ curl "http://localhost:8080?quality=30&width=100&height=200" \
-X POST \
--data-binary '@original.png' \
-H 'content-type:image/png' \
-H 'accept:image/jpeg' \
> compressed.jpg
content-type
/accept
can either beimage/png
,image/jpeg
orimage/gif
.quality
can be an integer value ranging from 1 to 100.- It takes effect only when the output is in jpeg format, i.e.
accept
is set toimage/jpeg
.
- It takes effect only when the output is in jpeg format, i.e.
width
andheight
set the size of the output image in pixels.- If
width
is set andheight
is not set,height
will be such that the original aspect ratio will be kept, and vice versa. - If both of them are not set, the original size will be kept unchanged.
- If
- The port 8080 is used as default. To change the port to listen on, set
PORT
environment variable.