memer.rs
A Rust CLI tool for generating memes using OpenAI's DALL-E 3 API.
Description
memer.rs is a command-line interface that allows you to generate meme images by simply providing a text query. The tool uses OpenAI's DALL-E 3 model to create internet-style memes with bold, impact font text and high-contrast visuals.
Features
- Fast meme generation using DALL-E 3
- Automatic UUID-based file organization
- Optimized for classic meme format (top/bottom text, bold styling)
- Async/await for efficient API calls
- Configurable output directories
Installation
Prerequisites
- Rust (latest stable version)
- OpenAI API key
From Source
From Crates.io
Setup
- Get an OpenAI API key from OpenAI Platform
- Create a
.envfile in the project root:
OPENAI_API_KEY=your_api_key_here
Usage
Basic Usage
Custom Output Directory
Help
Options
-q, --query <QUERY>: The meme description/topic (required)-f, --folder <FOLDER>: Output directory (default: random UUID)
Examples
# Generate a programming meme
# Generate a relatable meme with custom folder
# Generate a Rust-specific meme
Output
Generated images are saved as 1024x1024 PNG files in the specified directory. The tool automatically creates the directory if it doesn't exist.
Technical Details
- Language: Rust 2024 edition
- Image Model: DALL-E 3
- Image Format: Base64 JSON → PNG
- Image Size: 1024x1024 pixels
- Async Runtime: Tokio
Dependencies
async-openai: OpenAI API clientclap: Command-line argument parsingtokio: Async runtimedotenv: Environment variable loadingminijinja: Template renderinguuid: Unique identifier generation
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
Apache License 2.0
Acknowledgments
- OpenAI for the DALL-E 3 API
- The Rust community for excellent crates
Note: This tool requires an active OpenAI API subscription. Image generation costs apply according to OpenAI's pricing.