Skip to main content

Generate stickers with transparent backgrounds using Gemini AI

Project description

Sticker Generator

Generate stickers with transparent backgrounds using Google's Gemini AI.

Installation

pip install sticker-generator

Setup

Set your Gemini API key as an environment variable:

export GEMINI_API_KEY="your-api-key"

Or pass it directly to the functions/CLI.

Usage

Command Line

# Basic usage
sticker-generator "a cute happy cat with big eyes"

# Specify output file
sticker-generator "a rocket ship" -o rocket.png

# Use reference images
sticker-generator "similar style illustration" -i reference1.png -i reference2.png

# Custom aspect ratio
sticker-generator "a wide banner" --aspect-ratio 16:9

# Save raw image before processing
sticker-generator "a dog" --save-raw

Python API

from sticker_generator import create_sticker

# Basic usage
sticker = create_sticker(
    prompt="a cute happy cat with big eyes",
    output="cat.png"
)

# With reference images
sticker = create_sticker(
    prompt="similar style illustration",
    output="custom.png",
    input_images=["reference1.png", "reference2.png"]
)

# Just get the image without saving
sticker = create_sticker(
    prompt="a rocket ship",
    output=None  # Returns PIL Image
)

Image Processing Only

If you have your own green-screen images:

from PIL import Image
from sticker_generator import remove_green_screen_hsv, cleanup_edges

# Load your image
img = Image.open("green_background.png")

# Remove green background
transparent = remove_green_screen_hsv(img)

# Clean up edges
clean = cleanup_edges(transparent, threshold=64)

# Save
clean.save("transparent.png")

How It Works

  1. Generation: Uses Gemini AI to generate an image with a chromakey green (#00FF00) background
  2. Green Removal: Converts to HSV color space and removes pixels matching green hue
  3. Edge Cleanup: Removes semi-transparent edge artifacts for clean results

License

MIT

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

sticker_generator-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

sticker_generator-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file sticker_generator-0.1.0.tar.gz.

File metadata

  • Download URL: sticker_generator-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for sticker_generator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ed066b1c33655856ba643cde30db40cbcb9f32382a958d3b0af4ef532773fab
MD5 f2fd27aaf90c298943ef58423773fd54
BLAKE2b-256 f6c74e6bb53b65b8961a7141be7700d28910edf1ee05ca60aec8ccaddeb2f4eb

See more details on using hashes here.

File details

Details for the file sticker_generator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sticker_generator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09036928231afb4b800b245567ec8f1186c09aebb919f7cfeb6534673f29e494
MD5 435e154c84d63c176b61f43b6ab6c48d
BLAKE2b-256 cf40ae18794a8371ab7513de99851e5fce1469068db1eb961c128119bad02cf7

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