This is a submission for the DEV's Worldwide Show and Tell Challenge Presented by Mux
What I Built
Blog Cover Generator is an AI-powered web application that creates professional blog cover images in seconds. Instead of spending hours in design tools or paying for stock images, content creators can simply enter their article title, choose a visual style, and get multiple AI-generated cover options tailored to their preferred blogging platform.
The app generates 2 unique images per request using Google's Gemini AI, offers 6 distinct visual styles (Creative, Cinematic, Minimalist, Professional, Abstract, and Tech), and automatically resizes images for Hashnode, Dev.to, Medium, or custom dimensions. Users can also add text overlays with customizable fonts, positioning, and shadow effects.
My Pitch Video
Demo
- Live App: https://blog-cover-generator-912048666815.us-central1.run.app
- GitHub Repository: https://github.com/ifihan/blog-cover-generator
Testing Instructions
- Visit the live demo link
- You can generate covers without creating an account
- Enter any blog title (e.g., "Building Scalable APIs with Python")
- Select a style (try "Cinematic" or "Tech" for striking results)
- Click Generate and wait for your AI-generated covers
- Select an image, choose your target platform, and download
Optional: Create an account to save your generation history and access previous covers from your dashboard.
The Story Behind It
As a developer who writes technical articles, I constantly faced the same frustrating workflow: spend hours writing quality content, then scramble to find or create a decent cover image. Stock photos felt generic. Canva templates looked like everyone else's. Custom designs took too long.
I wanted something that understood the context of my article and generated visuals that actually matched the content - not just random tech imagery slapped together. That's when I decided to build Blog Cover Generator.
The core idea is simple: your article title already contains the essence of what you're writing about. Why not use AI to transform that into a visual representation? A post about "Building Microservices" should look different from one about "CSS Animation Tips" - and now it can, automatically.
What Makes It Special
- Context-aware generation: The AI interprets your title's meaning, not just keywords
- Platform-optimized: One-click export to exact dimensions for Hashnode (1600x840), Dev.to (1000x420), or Medium (1500x750)
- Style variety: From corporate presentations to cyberpunk aesthetics, there's a style for every type of content
- Text overlay engine: Add your title directly on the image with professional typography
- No design skills needed: Get results that would take hours in Photoshop, delivered in seconds
Technical Highlights
Architecture Overview
The application is built with a Python/Flask backend and vanilla JavaScript frontend, deployed on Google Cloud Run with PostgreSQL (Neon) for persistence.
Frontend (Vanilla JS) → Flask API → Google Gemini AI
→ Google Cloud Storage
→ PostgreSQL (Neon)
AI Image Generation
The core magic happens in the prompt engineering. Each style has carefully crafted prompt templates that guide Gemini to produce consistent, high-quality results:
STYLE_PROMPTS = {
"cinematic": "dramatic lighting, high contrast, movie poster aesthetic,
depth of field, professional color grading",
"tech": "cyberpunk aesthetic, neon accents, circuit patterns,
futuristic elements, dark background with glowing highlights",
# ... more styles
}
The system combines the user's title with style-specific descriptors and negative prompts to avoid common AI image pitfalls (no text, no watermarks, no distorted elements).
Intelligent Image Processing
One of the trickier challenges was handling different aspect ratios without awkward cropping. The image processor uses aspect ratio calculations to determine optimal crop regions:
def resize_and_crop(image, target_width, target_height):
# Calculate aspect ratios
target_ratio = target_width / target_height
current_ratio = image.width / image.height
# Smart crop: center-weighted for most content preservation
if current_ratio > target_ratio:
# Image is wider - crop sides
new_width = int(image.height * target_ratio)
offset = (image.width - new_width) // 2
image = image.crop((offset, 0, offset + new_width, image.height))
# ... handle other cases
Text Overlay Engine
The text overlay system supports:
- 9 positioning options (3x3 grid)
- Automatic line wrapping for long titles
- Shadow effects for readability on any background
- Font fallback system (works on both macOS and Linux deployments)
Performance Optimizations
- Lazy initialization: Heavy services (AI client, cloud storage) only initialize on first use
- In-memory caching: Generated images stored temporarily before user saves, reducing API calls
- Efficient queries: SQLAlchemy joinedload prevents N+1 query problems in the dashboard
Tech Stack Summary
| Layer | Technology |
|---|---|
| Backend | Flask, SQLAlchemy, Gunicorn |
| AI | Google Gemini 2.5 Flash |
| Database | PostgreSQL (Neon) |
| Storage | Google Cloud Storage |
| Image Processing | Pillow |
| Deployment | Docker, Google Cloud Run |
| Auth | Flask-Login, Werkzeug |
What's Next
Future improvements I'm considering:
- Batch generation for multiple articles
- Template saving for consistent branding
- API access for headless CMS integration
- Additional AI models for style variety
Thanks for checking out Blog Cover Generator! If you write technical content and hate the cover image hunt, give it a try. I'd love to hear your feedback.
Top comments (0)