image-server

command module
v0.0.0-...-e135e79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 7 Imported by: 0

README

image-server is a simple http server that accepts an image, converts it to a different format, resizes/compresses it and sends it back.

codecov

Run on CloudRun

Run on Google Cloud

Usage

$ 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 be image/png, image/jpeg or image/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 to image/jpeg.
  • width and height set the size of the output image in pixels.
    • If width is set and height 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.

Notes

  • The port 8080 is used as default. To change the port to listen on, set PORT environment variable.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL