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.0.tar.gz (6.9 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.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: thonk-1.0.0.tar.gz
  • Upload date:
  • Size: 6.9 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.0.tar.gz
Algorithm Hash digest
SHA256 f9b75ddee8c44e9f18f1b40cf7093790ac084457682f1c162413a477f7d23026
MD5 498dceece3b663fbff3d34e157e347a6
BLAKE2b-256 c61f54a402bc94f2b068e482b889053cb69a58989526ec5726c678d6ad7f8daa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: thonk-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c6dab5710313fbdf468f4fdb0d1d885773f604b7ced0f859dceeac88badf0c8
MD5 a10b73759186b67218186b800f749456
BLAKE2b-256 6e1929e0d69edb350d138744fd5309dd609b8f03bea2c289ed520a2d5a7ea658

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