Photo to Slack Emoji Converter & Image Editor
Transform any photo into a classic Slack-optimized emoji using Google's Nano Banana Pro (Gemini 3 Pro Image) model with automatic subject identification and style transformation. NEW: Edit existing images with natural language prompts!
When to Use This Skill
Use this skill when:
- Converting photos into Slack custom emojis
- Editing existing images/emojis (add hats, change colors, add accessories, etc.)
- Creating icon-style representations of people, pets, objects, or concepts
- Need automatic subject identification and isolation
- Transforming photos to match classic emoji aesthetics (flat, simple, expressive)
- Ensuring Slack's strict 64KB file size and dimension requirements are met
Overview
This skill combines:
- Google Nano Banana Pro (Gemini 3 Pro Image) - AI-powered subject identification, style transformation, and image editing with superior quality
- Slack Emoji Validators - Ensures compliance with Slack's 64KB limit and optimal dimensions
- Automatic Optimization - Color quantization, compression, and size validation
Two Main Workflows
1. Photo-to-Emoji Conversion (Original)
Photo Input → Gemini Identifies Subject → Transform to Emoji Style → Optimize for Slack → Validate
2. Image Editing (NEW!)
Existing Image → Natural Language Edit Prompt → Gemini Edits Image → Optimize (optional) → Save
How It Works
Photo Input → Gemini Identifies Subject → Transform to Emoji Style → Optimize for Slack → Validate
Workflow Steps:
- Upload photo - Provide path to source image
- AI identifies subject - Gemini's visual reasoning determines the main subject
- Style transformation - Converts to emoji/icon/sticker style with descriptive prompt
- Optimization - Reduces to 128x128, limits colors to 32-48, compresses to <64KB
- Validation - Confirms Slack requirements are met
Quick Start
Basic Photo-to-Emoji Usage
from core.photo_to_emoji import convert_photo_to_emoji
# Convert a photo to a Slack emoji
convert_photo_to_emoji(
input_path="~/Downloads/my_cat.jpg",
output_path="~/Desktop/cat_emoji.png",
style="classic_emoji",
description="happy cat face" # Optional: helps guide transformation
)
NEW: Image Editing Usage
IMPORTANT: Never override existing generated images. Always use a different output filename to preserve the original. Iterative editing works best when you can compare versions.
# Command line (easiest way)
python edit_image.py input.jpg output.png "add a party hat"
python edit_image.py cat_emoji.png cat_with_sunglasses.png "add cool sunglasses" --optimize
# WRONG: Don't overwrite the original
# python edit_image.py cat_emoji.png cat_emoji.png "edit" ❌
# CORRECT: Use a new filename
# python edit_image.py cat_emoji.png cat_emoji_edited.png "edit" ✅
# Python API
from core.gemini_client import GeminiImageClient
client = GeminiImageClient()
# Edit an existing image
with open("cat_emoji.png", "rb") as f:
image_data = f.read()
edited_data = client.edit_image(
image_data=image_data,
mime_type="image/png",
edit_prompt="add a party hat to the cat"
)
# Always save to a NEW filename
with open("cat_with_hat.png", "wb") as f:
f.write(edited_data)
Advanced Usage with Custom Styles
convert_photo_to_emoji(
input_path="~/Downloads/portrait.jpg",
output_path="~/Desktop/person_emoji.png",
style="flat_icon",
description="friendly person waving",
custom_prompt="Transform this photo into a simple, flat design icon with bold outlines, minimal details, solid colors, and a white background. Focus on the subject's key features and expression."
)
Available Styles
1. classic_emoji (Recommended for most use cases)
- Round, expressive, classic emoji aesthetic
- Simplified features with bold outlines
- High contrast, vibrant colors
- Perfect for faces, animals, and expressive subjects
Example prompt template:
Transform this photo into a classic emoji style: round shape, simplified features,
bold outlines, expressive and friendly, vibrant yellow/warm tones, minimal shading,
white or transparent background. Focus on the subject's main expression.
2. flat_icon
- Minimalist, flat design
- Simple geometric shapes
- Solid colors without gradients
- Best for objects, logos, symbols
Example prompt template:
Transform this photo into a flat, minimalist icon: simple geometric shapes,
solid colors, no gradients, bold clean outlines, modern flat design aesthetic,
white background. Capture the essence of the subject with minimal detail.
3. kawaii_sticker
- Cute, playful, Japanese kawaii aesthetic
- Rounded features, large eyes
- Pastel or vibrant colors
- Best for animals, characters, food
Example prompt template:
Transform this photo into a kawaii-style sticker: cute and playful, rounded features,
large expressive eyes, simple cel-shading, vibrant color palette, bold clean outlines,
white background. Make it adorable and friendly.
4. pixel_art
- Retro 8-bit/16-bit pixel art style
- Chunky pixels, limited color palette
- Nostalgic gaming aesthetic
- Best for characters, objects, icons
Example prompt template:
Transform this photo into pixel art: 16x16 or 32x32 pixel style, retro 8-bit aesthetic,
limited color palette (8-16 colors), chunky pixels, clear subject outline,
simple shading, transparent or solid background.
5. custom
- Provide your own transformation prompt
- Full control over style description
- Use for unique or specific aesthetic needs
API Configuration
Setting up Google Gemini API Key
You'll need a Google Gemini API key to use this skill.
- Get API Key: Visit Google AI Studio
- Set Environment Variable:
export GEMINI_API_KEY="your-api-key-here" - Or provide directly in code:
convert_photo_to_emoji( input_path="photo.jpg", output_path="emoji.png", api_key="your-api-key-here" )
API Costs
Google Gemini 2.5 Flash Image pricing:
- $30 per 1 million output tokens
- Each image = 1290 tokens (flat rate up to 1024x1024px)
- ~$0.039 per image generated
Very cost-effective for emoji creation!
Slack Requirements
Emoji Specifications (Strict)
- Max file size: 64KB (strict enforcement)
- Optimal dimensions: 128x128 pixels
- Recommended colors: 32-48 colors maximum
- Format: PNG with transparency support
Validation
The skill automatically validates and optimizes for these requirements:
from core.validators import validate_slack_emoji
# After conversion, validate
is_valid, report = validate_slack_emoji("emoji.png")
if is_valid:
print("✅ Ready to upload to Slack!")
else:
print(f"❌ Issues: {report}")
Examples
Example 1: Pet Photo to Emoji
# Convert a dog photo to a happy emoji
convert_photo_to_emoji(
input_path="~/Photos/my_dog.jpg",
output_path="~/Desktop/happy_dog_emoji.png",
style="classic_emoji",
description="happy golden retriever smiling"
)
Result: A round, simplified emoji-style dog face with expressive eyes and a big smile.
Example 2: Person Portrait to Icon
# Convert a headshot to a professional icon
convert_photo_to_emoji(
input_path="~/Photos/headshot.jpg",
output_path="~/Desktop/person_icon.png",
style="flat_icon",
description="professional person with glasses"
)
Result: A minimalist, flat design icon representation of the person.
Example 3: Food Photo to Kawaii Sticker
# Convert a pizza photo to cute sticker
convert_photo_to_emoji(
input_path="~/Photos/pizza.jpg",
output_path="~/Desktop/kawaii_pizza.png",
style="kawaii_sticker",
description="cute pizza slice with happy face"