Giter Club home page Giter Club logo

pagan's Introduction

pagan

Welcome to the Python Avatar Generator for Absolute Nerds.

Current version: 0.4.4

View the change history here.

Remember those good old days when your imagination was a big part of the computer gaming experience? Hardware limitations forced you to fill the void left by poorly pixelated images. Pagan brings back those nostalgic feelings by generating identicons in an old-school style inspired by retro roleplaying adventure games.

Pagan hashes input strings to generate unique avatar images intended for use as profile pictures in web applications. These images can be used to replace default user images for new accounts, or to enhance comment sections by visually representing a user's IP address or username.

Pagan is currently under development. It can perform the following functions:

  • Generate identicons with unique colors and gear based on any input string.
  • Use multiple hash functions from within Python's hashlib.
  • Create avatar images to fit a specific resolution.
  • Remap 16x16 generated pixelmaps to a required image size.
  • Expand generated pagans by adding new weapons or gear.

Enjoy the nostalgia!

Some example avatars hashed with SHA512:

Input Avatar
pagan pagan
python python
avatar avatar
github github
retro retro
piece of cake piece of cake
hash me if you can hash me if you can

Installation:

To install Pagan, first clone this repository:

>> git clone https://github.com/daboth/pagan.git

Then, enter this command at the terminal to manually install Pagan:

>> python setup.py install

Alternatively, use this command to install pagan via pip:

>> pip install pagan

Python usage example:

# Import the pagan module.
import pagan

# Acquire an arbitrary string.
inpt = 'pagan'

# Use pagan to generate an avatar object based on an input string.
# Optional: You may specify which hash function Pagan should use.
# The functions are available as constants.
# Default: MD5.
img = pagan.Avatar(inpt, pagan.SHA512)

# Open the avatar image in an
# external image viewer.
img.show()

# Set an output path and a file name.
# You don't need to specify a file ending.
# Choose a path depending on your OS.
outpath = 'output/'
filename = inpt

# Saves the avatar image as a .png file
# by omitting the path and name. The
# file endings will be generated automatically.
img.save(outpath, filename)

# You can change the avatar input and
# hash function anytime.
img.change('new input', pagan.SHA256)

Command Line Interface

The pagan command line interface can be used to generate avatars without needing to write a python script:

>> pagan [-h] [--show] [--output OUTPUT] [--hash HASH] input [input ...]

For example, typing

>> pagan hello

will generate an avatar from the string 'hello' and save it in the current working directory.

For more information, execute Pagan using the -h help parameter:

>> pagan -h

Webserver

A demo of Pagan can be run in a webserver application. To access the Pagan demo, execute the following instructions from the webserver directory:

>> cd /tools/webserver/
>> python webserver.py

Beware: This demo of Pagan will fill your temporary directory with generated image files. Do not run it in production!

The webserver will serve from localhost port 8080. Open this address in your browser window:

http://127.0.0.1:8080/

Supported Hashes

Hash Constant
md5 pagan.MD5
sha1 pagan.SHA1
sha224 pagan.SHA224
sha256 pagan.SHA256
sha384 pagan.SHA384
sha512 pagan.SHA512

Testing

To test Pagan, you must install either the pytest or tox Python modules. Configure tox.ini to test different Python versions.

Docker

To use pagan within Docker, you must build the Docker image with:

>> docker build -t pagan .

Then, run docker image

>> docker run -d -p 8080:8080 -t pagan

The webserver inside Docker will serve from localhost port 8080. Open this address in your browser window:

http://127.0.0.1:8080/

If you want to use PAGAN CLI, you just have to look for the IP Address of the Docker container and then connect through ssh with user: pagan and pass: pagan, like this:

>> ssh -X pagan@dockercontainerip

Using py.test

>> pip install pytest
>> pytest

Using tox

>> pip install tox
>> tox

pagan's People

Contributors

b1skit avatar daboth avatar intellbg avatar lovingtech avatar marcia-t avatar myungseokang avatar ofalk avatar rohitjha avatar timgates42 avatar wjv avatar xnor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pagan's Issues

Rework on templates

The templates to generate each figure are purely textbase, to enable everyone to contribute on this without any affinity or knowledge about programming. Do you think the system needs a rework? From my point of view, as i grew as a software/scientific guy, the currently implemented systems seems a bit outdated. Would appreciate everyones thought on that. This issue, by far however, is placed super late in my backlog, so take your time.

Increase virtual resolution to add more detail

Hello again. This is a big one. I really liked the original idea to limit myself on the overall virtual pixel output. What are your thoughts about increasing the size to generate more detailed figures and maybe even add background generation in this process. I'm aware that it would have a mayor impact on the idea, so i'd really like to read your thoughts on this one.

Support for cropped circles

Hello everyone. I lack the power to describe this topic, but you know the trend where every app takes your image and crops a circle from it? Yes, this looks bad with the native pagan output and will surely take some workaround if you consider pagan as a tool in an automated process. So i'm open for suggestions here. The first thing i could think of would be to just generate a bigger "outer space" around the actual image, but i'd like to reach out for a better, more "standalone too" option to cover this case.

Colorful Backgrounds

Hello to all supporters and a very special "Thank you" for using pagan in your projects. I never thought this one would draw such attention and i'm overwhelmed by the positive feedback it got. I got back into programming a while ago, so let's start out with some ideas. The first one being backgrounds. It always bothered me, that the backgrounds are plain as can be. Instead i started looking for some mechanics to generate some overall color metric from the generated virtual pixels to add a background in complementary colors to the mix. The challenge is to generate a background that does not only avoid to obfuscate the drawn figures, but actually highlight them, so that every result from pagan is a good and usable complete image.

Provide Docker Images [DONE]

The are currently no public Docker images available. An image would be useful for easy deployment of the webserver (in production and for testing purposes) as well as a convenient CLI without the need to install external dependencies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.