go-ppic
Profile picture generation service written in Go. A demo can be found at ppic.now.sh.
go-ppic provides two commands; ppic and ppicd.
ppic
ppic is used to generate profile pictures on the command line, without having to run a web server. ppic outputs the generated image to stdout.
Installation
go get -u github.com/jackwilsdon/go-ppic/cmd/ppicUsage
usage: ppic username [size] > image.png
sizedefaults to 512 if not provided
Examples
ppic jackwilsdon 1024 > profile.pngppicd
ppicd is a web server providing image generation.
Installation
go get -u github.com/jackwilsdon/go-ppic/cmd/ppicdUsage
ppicdThere are a number of environment variables that can be set to change how ppicd operates.
| Name | Description | Value | Default |
|---|---|---|---|
DEBUG |
Whether or not the pprof routes should be enabled. | 0 or 1 |
0 |
GZIP |
Whether or not responses should be gzipped. | 0 or 1 |
1 |
PORT |
The port to run the server on. | Number | 3000 |
Once the server is running, you can retrieve an image by visiting http://localhost:3000/image.png (provided you haven't changed PORT). Other supported file extensions are .gif and .jpeg, defaulting to .png if there is no file extension in the URL.
You can change the size of images which are generated by adding ?size=1024 to the end of the URL.
A palette can be specified by adding ?palette=[name] to the request. There are currently only two palettes available;
- Default
- Candy
You can swap the foreground and background colors by adding ?inverse to the request.
Limitations
Here is a list of known limitations (subject to change);
- Image size must be a multiple of 8