An open API service indexing awesome lists of open source software.

https://github.com/jackwilsdon/go-ppic

A simple profile picture generator written in Go
https://github.com/jackwilsdon/go-ppic

go image-generator

Last synced: about 1 year ago
JSON representation

A simple profile picture generator written in Go

Awesome Lists containing this project

README

          

# go-ppic

Profile picture generation service written in Go. A demo can be found at [go-ppic.herokuapp.com](https://go-ppic.herokuapp.com/hello).

`go-ppic` provides two commands; [`ppicd`](#ppicd) and [`ppic`](#ppic).

## ppicd

`ppicd` is a web server providing image generation.

### Installation

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

### Usage

```Text
-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;

```Text
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

```Shell
go get -u github.com/jackwilsdon/go-ppic/cmd/ppic
```

### Usage

```Text
usage: ppic text [size] > image.png
```

> `size` defaults to 512 if not provided

### Examples

```Shell
ppic jackwilsdon 1024 > profile.png
```