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

https://github.com/vitkarpov/lorempixum

Golang package for creating images` stubs
https://github.com/vitkarpov/lorempixum

Last synced: about 2 months ago
JSON representation

Golang package for creating images` stubs

Awesome Lists containing this project

README

        

# Lorempixum

Lorempixum is a golang package for generating stub images with the given sizes.

## Install

```
$ go get github.com/vitkarpov/lorempixum
```

## Overview

Let's take a look at simple usage example.

```go
package main

import (
"github.com/vitkarpov/lorempixum"
"os"
)

func main() {
img := lorempixum.GetImage(100, 100)
lorempixum.StreamImage(os.Stdout, img, "jpeg")
}
```

This tiny program writes a new jpeg image to stdout:

```
$ go build ./example/main.go && ./main > foo.jpeg
```

Lorempixum supports jpeg, png and gif for animated stubs.

## API

#### func GetImage

```go
func GetImage(width, height int) *image.Paletted
```

#### func StreamImage

```go
func StreamImage(out io.Writer, img *image.Paletted, format string) error
```