Giter Site home page Giter Site logo

pyavagen's Introduction

pyavagen

build_badge versions_badge pypi_badge license_badge

Generation of customizable avatars.

Requirements:

  • Python 3.3+
  • Pillow

Installation:

pip install pyavagen

Avatar types

For avatar generation using the Avatar class.

Arguments:

  • kwargs - keyword arguments that are passed to specified avatar_class.
  • avatar_type - avatar type that will be generates an image.

Types:

  1. pyavagen.SQUARE_AVATAR or 'square'
  2. pyavagen.CHAR_AVATAR or 'char'
  3. pyavagen.CHAR_SQUARE_AVATAR or 'char_square'

Avatar types description is given below.

Char avatar

Draws a character on background with single color.

Demo 4 Demo 5 Demo 10 Demo 12

Usage:

import pyavagen


avatar = pyavagen.Avatar(pyavagen.CHAR_AVATAR, size=500, string="Paul")
avatar.generate().save('avatar.png')

Arguments:

  • size - size of output image. The integer type.
  • string - first chars of two first words that separated whitespaces. For example from string 'John Paul' draws "JP". If passed an one word then draws a first char of this word. For example from string 'John' draws "J". The string type.
  • font - TrueType or OpenType font file. Path to font file. Default Comfortaa-Regular.
  • background_color - background color. If not passed that a will be a random color from color_list.
  • font_size - size of font. The integer type. Has default value.
  • font_color - color of font. The string type. Default white.
  • font_outline - Outline of character. Default false.
  • color_list - list of colors from which will be generating colors for background. Default pyavagen.COLOR_LIST_FLAT.

Square avatar

Draws squares with different colors.

Demo 1 Demo 2 Demo 3 Demo 11

Usage:

import pyavagen


avatar = pyavagen.Avatar(pyavagen.SQUARE_AVATAR, size=500)
avatar.generate().save('avatar.png')

Arguments:

  • size - size of output image. The integer type.
  • squares_on_axis - number of squares on axis. The integer type. Default random value from 3 to 4.
  • blur_radius - blur radius. Used PIL.ImageFilter.GaussianBlur.The integer type. Default 1.
  • rotate - image rotate. The integer type. Default random rotation.
  • border_size - border size of square. The integer type. Default 0.
  • border_color - border color of squares. The string type. Default black.
  • color_list - list of colors from which will be generating colors for squares. By default a set of flat colors (pyavagen.COLOR_LIST_FLAT). If color_list passed as an empty list then will be generation a random color. There is also list of colors in material style - pyavagen.COLOR_LIST_MATERIAL.

Char square avatar

Draws a character on background with squares with different colors.

Demo 6 Demo 7 Demo 8 Demo 9

Usage:

import pyavagen


avatar = pyavagen.Avatar(pyavagen.CHAR_SQUARE_AVATAR, size=500, string="Jack")
avatar.generate().save('avatar.png')

Arguments:

The same arguments as for Square avatar and Char avatar.

Testing

Execute tox from the project root.

pyavagen's People

Contributors

lxbrvr avatar

Stargazers

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

Watchers

 avatar

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.