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.1.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.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: thonk-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3249167571d8dabe425937effe26dc67f2366b49b3d1c58dcb358868f17ba509
MD5 be7297367d79bcf97a3b0e4f17dac8c5
BLAKE2b-256 22a2585d434246222477d1e751d69490d69c338e018d8f33155c2b9665d17da4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thonk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3334a0f770a14ef75a3fd8b4d2cfbfca7c361cf1b95e6a91001a194b427e1efe
MD5 4e7b520993e0aea8bbfba043b56a55b8
BLAKE2b-256 4ca69ff7f13bb3146c932a0259589f88aa4d9598ca445b032fbbafdfb1fa4a50

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