# Pixelated Avatar Generator [![Travis CI Status](https://api.travis-ci.org/ExcaliburZero/pixelated-avatar-generator.svg)](https://travis-ci.org/ExcaliburZero/pixelated-avatar-generator) [![Coverage Status](https://coveralls.io/repos/github/ExcaliburZero/pixelated-avatar-generator/badge.svg?branch=master)](https://coveralls.io/github/ExcaliburZero/pixelated-avatar-generator?branch=master)
Pixelated Avatar Generator is a Haskell library and application for generating pixelated avatar images from seed values.

```haskell
import Graphics.Avatars.Pixelated

createAndSaveAvatar :: String -> FilePath -> IO ()
createAndSaveAvatar s path = saveAvatar avatar path
  where avatar = scaleAvatar 32 $ generateAvatar seed
        seed   = createSeed s
```

![Some examples of avatars generated by the library.](example_image.png)

## Library
Pixelated Avatar Generator is a library which provides functions and data types for generating, altering, and saving pixelated avatars.

For information on how to use the library, see the documentation for the [`Graphics.Avatars.Pixelated`](https://hackage.haskell.org/package/pixelated-avatar-generator/docs/Graphics-Avatars-Pixelated.html) module.

### Documentation
The documentation for the latest release of the library can be found in [the library's Hackage entry](https://hackage.haskell.org/package/pixelated-avatar-generator).

Documentation of the development versions of the library can be generated by running the following command in the main directory of the project:

```
$ stack haddock
```

The generated html documentation can then be found in the following directory:

```
.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/doc
```

## Executable
An example executable program that uses the library is also provided. It creates an avatar from a given seed string and saves the created `.png` image to a given file location.

The executable can be compiled by running the following command:

```
$ stack build
```

The executable can then by run by running it with `stack exec` and providing it the desired filepath of the output file including the `.png` extension and a random seed string.

```
$ stack exec pixelated-avatar-generator image.png "Hello, World"
Creating avatar at image.png
Grey
█ ████ █
        
  ████  
█  ██  █
████████
█ █  █ █
█      █
████████
Successfully created avatar, and saved it to image.png
```

### Usage
```
Usage: pixelated-avatar-generator FILEPATH SEEDSTRING

FILEPATH   -- The location to save the generated avatar at. "img/test.png"
SEEDSTRING -- The string to use to generate the avatar. "Hello"
```

## Links
* [Pixelated Avatar Generator package on Hackage](https://hackage.haskell.org/package/pixelated-avatar-generator)

## License
The source code of Pixelated Avatar Generator is available under the [MIT license](https://opensource.org/licenses/MIT), see `LICENSE` for more information.