Skip to main content

Generate randomized thinking emoji images

Project description

Thonk

Tired of the same old thinking emoji? Here's an infinite supply of new ones.

Purpose

Generates unique thinking emojis with completely randomized features.

from thonk import generate_thonk

img = generate_thonk(seed=42)
img.save("thonk.png")

Same seed always produces the same image. Different seeds produce wildly different results.

Installation

pip install thonk

Requires Python 3.8+ and Pillow (installed automatically).

Usage

from thonk import generate_thonk

# Returns a PIL Image in RGBA mode
img = generate_thonk(seed=42)

# Output size in pixels (default 512)
img = generate_thonk(seed=42, output_size=1024)

# Seeds can be any hashable value
img = generate_thonk(seed="thonk")

# Save, encode, display
img.save("thonk.png")
img.save("thonk.webp")
img.show()

How it works

Each image is built from a set of randomized polygon features - face, eyes, mouth, eyebrows, and hand - smoothed with Chaikin's algorithm and composited in order onto a transparent canvas.

  • Face - An irregular blob whose points are pushed outward from center by a random amount, controlled by a spikiness value.
  • Eyes - Placed at random positions inside the face (or a 1/20 chance to be placed outside), using the same blob construction with a lesser spikiness range.
  • Mouth - One of five moods: neutral (rectangle), open smile/frown (Bézier curve), or closed smile/frown (a filled ellipse arc).
  • Eyebrows - Thick angled strokes above each eye; if the eyes are close in height, they're merged into a unibrow instead.
  • Hand - Three smoothed rectangles (thumb, finger, palm) placed at the lowest point of the face, randomly rotated and scaled.
  • Bridging - If eyes or mouth land outside the face, they get their own blob to sit on, connected back to the face with a generated bridge shape.

Everything is rendered at 2x the target resolution and downsampled with a Lanczos filter for smooth edges.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thonk-1.0.2.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thonk-1.0.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file thonk-1.0.2.tar.gz.

File metadata

  • Download URL: thonk-1.0.2.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for thonk-1.0.2.tar.gz
Algorithm Hash digest
SHA256 be9289ecd3825e05a0b79d951f110f3ec33105f111215ef28faa95c11a0695d8
MD5 1ecac0eb3bb55edbb69aba0f929fb585
BLAKE2b-256 d6c3069d2fc75d32a0f279ffc2e10ca9a8f60ebce21450cd33941fcf6b9f24e5

See more details on using hashes here.

File details

Details for the file thonk-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: thonk-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for thonk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6091cd77e7e449025f566272e0cc4499446538482643e6aa63b83ea45379c5a6
MD5 1151407ae91d552bd1522c17ce8234af
BLAKE2b-256 cb355601ccc78a5c5be6736fc12ccc07e17aa1ba9aa90a0b5ee0fbf9b9aabf33

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page