A powerful YouTube thumbnail generator with AI text optimization and multi-language support
Project description
YouTube Thumbnail Generator 🎨
A powerful YouTube thumbnail generator with optional AI text optimization and multi-language support. Create eye-catching thumbnails with customizable backgrounds, fonts, and AI-enhanced text.
✨ Features
- Customizable Backgrounds: Solid colors, gradients, or image backgrounds
- Multiple Font Support: Various fonts and styles
- AI Text Optimization: Optional Gemini AI integration for better text
- Multi-Language Support: Automatic language detection or manual specification (supports
en/english,zh/chinese) - Flexible Layouts: Multiple text positions and sizes
- High Quality Output: 1280x720 HD thumbnails
- Docker Support: Easy deployment with Docker
🚀 Quick Start
Installation
# Clone the repository
git clone https://github.com/preangelleo/youtube-thumbnail-generator.git
cd youtube-thumbnail-generator
# Install dependencies
pip install -r requirements.txt
# Or install from PyPI
pip install youtube-thumbnail-generator
Basic Usage
Python Library
from src.thumbnail_generator import ThumbnailGenerator
# Create generator instance
generator = ThumbnailGenerator()
# Generate a simple thumbnail
thumbnail = generator.generate(
text="Amazing Python Tutorial",
output_path="thumbnail.png"
)
CLI Usage
# Basic thumbnail
youtube-thumbnail "Amazing Python Tutorial" -o thumbnail.png
# With AI optimization
youtube-thumbnail "Python Tutorial" --enable-ai --source-language en
# With translation (Chinese to English)
youtube-thumbnail "Python编程" --enable-ai --source-language zh --target-language en
# Custom styling
youtube-thumbnail "Tutorial" --font-size 100 --bg-color1 "#FF0000"
REST API
# Start the API server
python -m src.api
# Generate thumbnail via API
curl -X POST http://localhost:5000/generate \
-H "Content-Type: application/json" \
-d '{
"text": "Amazing Tutorial",
"enable_ai_optimization": true,
"source_language": "en" // Skip auto-detection
}'
With AI Optimization
# Enable AI optimization with explicit control
generator = ThumbnailGenerator(
gemini_api_key="your-api-key",
enable_ai_optimization=True # Explicit toggle
)
# Generate with explicit source language (skip detection)
# Supports both ISO codes and full names
thumbnail = generator.generate(
text="Python Tutorial for Beginners",
source_language="en", # or "english" - Skip detection, specify it's English
enable_ai_optimization=True,
output_path="ai_thumbnail.png"
)
# Generate with translation (requires AI)
thumbnail = generator.generate(
text="Python编程教程",
source_language="chinese", # or "zh" - Input is Chinese
target_language="english", # or "en" - Translate to English
enable_ai_optimization=True, # Required for translation
output_path="translated_thumbnail.png"
)
📚 Documentation
For detailed documentation, see docs/DOCUMENTATION.md
For usage examples, see examples/example_usage.py
🐳 Docker
# Pull from Docker Hub
docker pull preangelleo/youtube-thumbnail-generator:latest
# Run the API server
docker run -p 5000:5000 \
-e GEMINI_API_KEY=your-key \
-e ENABLE_AI_OPTIMIZATION=true \
preangelleo/youtube-thumbnail-generator
# Or build locally
docker build -t youtube-thumbnail-generator .
docker run -p 5000:5000 youtube-thumbnail-generator
🌐 API Endpoints
POST /generate
Generate a single thumbnail with full parameter control.
{
"text": "Amazing Tutorial",
"enable_ai_optimization": true,
"target_language": "en",
"background_type": "gradient",
"font_size": 80
}
POST /batch
Generate multiple thumbnails in one request.
{
"texts": ["Tutorial 1", "Tutorial 2"],
"enable_ai_optimization": false,
"target_language": "zh"
}
POST /optimize-text
Optimize text using AI (requires API key).
{
"text": "Basic Python Tutorial",
"target_language": "en",
"style": "engaging"
}
POST /detect-language
Detect the language of text.
{
"text": "Python编程教程"
}
🔧 Configuration
Create a .env file:
# Optional: Gemini AI API Key
GEMINI_API_KEY=your-api-key-here
# Optional: Enable AI by default
ENABLE_AI_OPTIMIZATION=true
# Optional: Default language
DEFAULT_LANGUAGE=en
📝 License
MIT License - see LICENSE file for details
🤝 Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
📧 Support
For issues and questions, please use the GitHub Issues page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file youtube_thumbnail_generator-2.6.4.tar.gz.
File metadata
- Download URL: youtube_thumbnail_generator-2.6.4.tar.gz
- Upload date:
- Size: 46.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf558d181a02a70a38eee878af077c7ae52947ed7fb29381596c55e2c76b5129
|
|
| MD5 |
b8bced98d9918b9aba1638976f58f618
|
|
| BLAKE2b-256 |
edc0768cd8bb180df0faf3af5956646ef2a03303d529b78b81ea4df2c20c3892
|
File details
Details for the file youtube_thumbnail_generator-2.6.4-py3-none-any.whl.
File metadata
- Download URL: youtube_thumbnail_generator-2.6.4-py3-none-any.whl
- Upload date:
- Size: 44.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a10118c6f728bcbe92b9392ef16329b380d2ff76bc8f486fe84c50e8ea652e1
|
|
| MD5 |
2d66fb1329f151e60edfa2ce7369e8e7
|
|
| BLAKE2b-256 |
f22baa23a91b6516ab6c511d402ee400608984572f7de2848c117009cf5c0f39
|