Skip to main content

CustomIdenticon

image

Python library for generate a variety of identicons.

image

Features

  • 3 different types of identicons
  • change the final image size (size of elements, number of elements)
  • change border size
  • change background color
  • change the transparency of elements
  • change the output format (PNG, JPEG, etc.)
  • choice of hashing algorithm (including your own)

Installation

pip install customidenticon

Usage

End image size = size * block_size + border * 2

import customidenticon
identicon = customidenticon.create(
    "Test data",            # Data
    type="pixels",          # Type of algorithm (pixels, blocks or layers)
    format="png",           # Output format
    salt="",                # salt for more variants
    background="#f0f0f0",   # background color
    block_visibility=140,   # transparency of elements in the image (0-255)
    block_size=30,          # size of elements (px)
    border=25,              # border (px)
    size=5,                 # number of elements
    hash_func=None          # hash function (auto)
)

Save

import customidenticon
identicon = customidenticon.create("Test data", size=5)
# identicon = b"\x89PNG\r\n\x1a\n\x00\x00\x00..."

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

# to image
import io
from PIL import Image
image = Image.open(io.BytesIO(identicon))

Hash algorithm

Use hashlib for change algorithm

import hashlib
import customidenticon
identicon = customidenticon.create("Test data", hash_func=hashlib.sha3_256)

Example custom hash algorithm

import customidenticon
class MySuperHashAlgorithm:
    def __init__(self, *args):
        pass
    def hexdigest(self):
        return "0"*200

identicon = customidenticon.create("Test data", hash_func=MySuperHashAlgorithm)

Examples

import customidenticon
# Create github-like (5x5)
identicon1 = customidenticon.create("Test") # 200x200px (default for all)
# or
identicon1 = customidenticon.create("Test", type="pixels") 

# Create "pixels" type (6x6)
# End image size 200x200px (6 * 25 + 25 * 2)
identicon2 = customidenticon.create("Test", size=6, block_size=25) 

# Create "layers" type (3 layer)
# End image size 200x200px (default size = 3 and block_size = 50)
identicon4 = customidenticon.create("Test", type="layers")

# Create "layers" type (8 layer)
# End image size 200x200px (8 * 20 + 20 * 2)
identicon5 = customidenticon.create("Test", type="layers", size=8, block_size=20, border=20)

# Create "blocks" type (3x3) (200x200px)
identicon6 = customidenticon.create("Test", type="block", block_visibility=100)
Result

image

Metadata

Release files for customidenticon 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for customidenticon 0.1.5
File Size Uploaded Provenance Actions
customidenticon-0.1.5.tar.gz 3.9 kB Without provenance Details for customidenticon-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for customidenticon 0.1.5
File Interpreter ABI Platform Actions
customidenticon-0.1.5-py3-none-any.whl Python 3 none any Details for customidenticon-0.1.5-py3-none-any.whl

Total release size: 8.6 kB

Release files / customidenticon-0.1.5.tar.gz

Download URL customidenticon-0.1.5.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c5d50ff29f28230ecc7299eb27dd349e8e30e72761c7335505083b4f871f70f4
BLAKE2b-256 checksum
How to use checksums
7ace3cd490ec7443f53a27e6981f523eb7be1a04c87d6c60d5906f4de80e79a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / customidenticon-0.1.5-py3-none-any.whl

Download URL customidenticon-0.1.5-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a49d288a2adc466f4feed7b49cf9691a8d9699d01892c810e70aab4a237f30cb
BLAKE2b-256 checksum
How to use checksums
f5b16be651171554536b7b0eb9da567c746f587a463e6fe453071bf2c351288b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for customidenticon 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page