You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

comforticons

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comforticons

ComfortIcons is an identicon generation module for different identicon/icon/gravatar/avatar flavors

0.1.0
pipPyPI
Maintainers
1

Comforticons

This package is an identicon generation module for different identicon/icon/gravatar/avatar flavors.

See libravatar project and gravatar project.

This module is heavly inspired by bitverseio's PHP Identicon Generator architecture/generators and azaghal's pydenticon package (gravatar retro-like identicon generator).

Source

Link to source.

Requirements

  • Python 3.8+
    • pillow 9.5+

Installation

This module is available on pypi.org.

Newest PyPi version

pip install comforticons

Features

  • Modular Identicon factory architecture

    preprocessors list and generator class powered identicon generation

  • Abstract/Interface implementations for data preprocessor and identicon generator
  • Pillow 9.5+ support
  • MyPy typings support

Roadmap

  • ASCII-denticon generation in this package.
  • SVG support for ring identicon in this package with svglib project.
  • More programmer-friendly generator architecture (choose return type - PIL.Image, bytes), (direct writing to file).
  • Django integration.
  • Self-hosting solution for small ecosystems with FastAPI.
  • Custom error classes implementation.

Usage

Interactive

python3 -m comforticons

Basic

from comforticons import Identicon

# Customize preprocessors and generator settings here
generator = Identicon()

# This will generate 120x120 with 0 padding PNG identicon
# with transparent background 5x5 pixel identicon (retro gravatar)
# using PixelGenerator and MD5Preprocessor as default
identicon = generator.generate("provide data here")

# Save to file
with open("image.png", "wb") as file:
    file.write(identicon)

Advanced

from comforticons import Identicon
from comforticons.preprocessors.hash import * # *Preprocessor
from comforticons.generators.image import * # PixelGenerator

# Customize preprocessors and generator settings here
generator = Identicon(
    # First, process data with md5, then with sha1
    preprocessors = [MD5Preprocessor(), SHA1Preprocessor],
    generator = PixelGenerator(
        size = 10, # 10x10 grid
        foreground_colors = ["#ffffff"], # Only use white foreground
        background = "#000000", # black, non-transparent background
        image_format = "png",   # PNG image format
        invert = True,          # This will swap bg-fg colors
    )
)

# Actually generate identicon
identicon = generator.generate("provide data here")

# Save to file
with open("image.png", "wb") as file:
    file.write(identicon)

Examples

MD5Preprocessor + PixelGenerator
"identicon"
identicon

SHA1Preprocessor + PixelGenerator
"identicon"
identicon

Licensing

See LICENCE.

Also see this LICENCE.

Keywords

identicon

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.