A simple profile picture generator written in Go
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead, 1 commit behind master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
cmd
.golangci.yml
.travis.yml
Dockerfile
LICENSE
README.md
generate.go
generate_test.go
handler.go
handler_test.go
now.json
palette.go
palette_test.go

README.md

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/ppic

Usage

usage: ppic username [size] > image.png

size defaults to 512 if not provided

Examples

ppic jackwilsdon 1024 > profile.png

ppicd

ppicd is a web server providing image generation.

Installation

go get -u github.com/jackwilsdon/go-ppic/cmd/ppicd

Usage

ppicd

There 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