go-ppic
go-ppic copied to clipboard
A simple profile picture generator written in Go
go-ppic

Profile picture generation service written in Go. A demo can be found at go-ppic.herokuapp.com.
go-ppic
provides two commands; ppicd
and ppic
.
ppicd
ppicd
is a web server providing image generation.
Installation
go get -u github.com/jackwilsdon/go-ppic/cmd/ppicd
Usage
-d enable pprof debug routes
-h string
host to run the server on
-p uint
port to run the server on (default 3000)
-v enable verbose output
-z enable gzip compression
After starting up the server, you should see something similar to the following output;
2006/01/02 15:04:05 starting server on http://127.0.0.1:3000...
Visiting the URL that the server is running on will give you the image for an empty string. You can get the image for
the string "example" by visiting /example
on the server (http://127.0.0.1:3000/example
in this case).
URL Parameters
The server accepts the following query parameters to change the response;
-
?size=N
→ specify the size of the image to return (must be a multiple of 8) -
?monochrome
→ change the image to black and white
Supported Extensions
By default the server will respond in PNG format, but it also supports the following file extensions;
-
.gif
-
.jpeg
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 text [size] > image.png
size
defaults to 512 if not provided
Examples
ppic jackwilsdon 1024 > profile.png