ref: v0.1.0 dummy/cmd/dummyserver/api.md -rw-r--r-- 2.8 KiB
5635acb8Mendel E Go module 11 months ago


Being that this uses http.ServerMux, if you need to avoid caching you can add to your endpoint path, and it will still reach its correct handler. You can see the docs to learn more.


This is the main endpoint. You can pass it options as url query params, and it will return a png image.

GET /web/

This endpoint will return an HTML file, with OpenGraph meta tags, and a link to the generated image in og:image. It will take the same options as GET /, plus some specific to the meta tags.

GET /tar/
GET /zip/

These endpoints will return an archive with 5 images:

  • favicon-16x16.png
  • favicon-32x32.png
  • apple-touch-icon.png
  • android-chrome-192x192.png
  • android-chrome-512x512.png

The apple-touch-icon.png is 180x180, the other files the size is pretty evident.

These endpoints take the same query params as GET /, except that the width, height, and dpi are set automatically.


Options can be passed as URL query params. The options are described here as:

name	type	default_value	limitations

All options are, optional. There should always be a fallback value.

width	int	100	max:4096
height	int	100	max:4096

Set the width and height of the image. If only width is passed, height will be set to its value.

mask	string	"plain"

Set the mask for the image drawing. The different masks are:

  • plain: just a plain, one color, background.
  • diagonal: split diagonally, two colors.


  • vertical: split vertically, two colors.
  • horizontal: split horizontally, two colors.
color	[]string	[]string{"#242933", "#eceff4"}

Set the colors to be used for the image. Hex strings can be in any of the following formats: rgb, rgba, rrggbb, rrggbbaa. It is not case-sensitive, hashes (#) at the start will be ignored, and alpha will be set to 255 (ie ff) if not passed. You can pass more than one color, and they will be used as needed.

desc	string	""

This option is only available on the /web/ endpoint.

Set the og:description content.

#Text options

text	string	""

Set the text content to be rendered on the image. The text color will be the last passed color param.

font	string	""

Set the font family for the text. There will be a default, set in the config.

size	float64		80.0	max:240.0

Set the font size for the text.

dpi		float64		72.0	max:720.0

Set the dpi for font rendering.

#Text options (WIP)

center	string	"height"

Text can be set centered in two ways: on the actual height of the text, which can vary depending on the letter (ie, l is a lot taller than _), or on a consistent (among other letters in its font) baseline.