Apr 27, 2025
AI Presentation Generator
Building presentations takes forever. What if you could skip the tedious parts and let AI do the heavy lifting?
In this guide, I'll show you how to build your own presentation generator. I've included the exact prompt I used at the end of this article.
Here's what you need to do:
- Use Cursor AI code editor to create a presentation generator using the prompt below
- Set up your API keys:
- Get an OpenAI API key for text and image prompts, and save it to ~/.mingdaoai/openai.key
- Get a Replicate API key, and save it to ~/.mingdaoai/replicate.key
- Write your presentation outline in a markdown file
- Run the scripts to generate your presentation:
- Step 1: Turn your outline into titles and image prompts
- Step 2: Generate images for each slide
- Step 3: Combine titles and images into slides
- Step 4: Combine all slides into a final presentation
Cursor AI Prompt
Save the following sections to a file called content.md, then let Cursor AI generate the code for you.
Overview
The presentation system has four scripts:
present1_content_generator.py- Creates slide content with titles, speaker notes, and image promptspresent2_image_generator.py- Generates images for each slide using the promptspresent3_image_text_composer.py- Combines images and text into final slidespresent4_video_generator.py- Turns the slides into a video presentation
Files You Need
Before running the scripts, make sure you have these files in your presentation folder:
present.md- Your presentation outline and requirementspresent_format.json- Settings like dimensions and layout
Script Details
1. Content Generator (present1_content_generator.py)
# What it does:
- SlideContent class stores slide data
- SlideContentGenerator uses OpenAI API to create content
- Supports Chinese and English
- Creates titles, speaker scripts, and image prompts
- Saves everything to present_content.txt
2. Image Generator (present2_image_generator.py)
# What it does:
- SlideImageGenerator handles image creation
- Uses mutil.genPictureUtil for generating images
- Can process one slide or batch generate
- Checks that images and prompts are valid
- Saves images as webp files
3. Image Text Composer (present3_image_text_composer.py)
# What it does:
- Puts images and text together on slides
- Handles layout and positioning
- Supports different presentation styles
- Creates high-quality slide images
4. Video Generator (present4_video_generator.py)
# What it does:
- Turns slides into a video
- Adds transitions and timing
- Can add background music
- Outputs the final video
How to Use It
- Create a
present.mdfile with your presentation outline - Create a
present_format.jsonfile with your preferred dimensions - Run the scripts in order:
python present1_content_generator.py python present2_image_generator.py python present3_image_text_composer.py python present4_video_generator.py
Requirements
- Python 3.8 or newer
- OpenAI API key (saved to ~/.mingdaoai/openai.key)
- Python packages you'll need:
- openai
- Pillow
- pathlib
- typing
- json
- argparse
What You Get
The scripts create these files:
present_content.txt- All slide contentimages/folder - Generated imagespresent_*.webp- Individual slide imagespresent_*_prompt.json- Image prompts in JSON formatpresent_*_prompt.txt- Image prompts as plain text- Final video file