# π Certificate Maker
A Rust-based certificate generation tool that creates personalized certificates
by overlaying names from CSV files onto PNG templates with customizable fonts, colors, and positioning.
## β¨ Features
- **π PNG Analysis**: Analyze image properties, dimensions, and technical details
- **βοΈ Interactive Text Overlay**: Add custom text to images with font and color selection
- **π― Batch Certificate Generation**: Generate hundreds of certificates from CSV name lists
- **ποΈ Menu-Driven Interface**: No manual path typing - select files from organized directories
- **π¨ Font Management**: Choose from fonts in your assets directory
- **π Debug Tools**: Troubleshoot CSV files, templates, and fonts
- **π Smart File Organization**: Automatic directory structure for easy management
## π Quick Start
### Prerequisites
- [Rust](https://rustup.rs/) (latest stable version)
- PNG template files
- CSV files with names
- Font files (TTF/OTF)graph TB
%% Main Entry
CLI[main.rs<br/>π Menu System]
%% Menu Options
subgraph Menu[Key Options]
M1[Single Image Text]
M2[Batch Certificates]
M3[PNG Analysis]
M4[Debug Tools]
end
%% Core Modules
subgraph Modules[Core Modules]
Edit[editpng.rs<br/>πΌοΈ Add Text to Images<br/>Font & Color Control]
CSV[csvexcelparser.rs<br/>π CSV Parser<br/>Batch Generator<br/>Parallel Processing]
Analysis[analysis.rs<br/>π PNG Technical Analysis<br/>Coordinate Calculator]
end
%% Directories
subgraph Dirs[File Structure]
Template[π Template/<br/>PNG/JPG templates]
Excel[π excelcsvs/<br/>CSV with names]
Assets[π assets/<br/>Font files .ttf]
Output[π output/<br/>Generated certs]
end
%% Dependencies
Deps[π¦ Dependencies<br/>image β’ imageproc β’ csv<br/>rayon β’ rusttype β’ png]
%% Connections
CLI --> Menu
Menu --> Modules
Dirs --> Modules
Deps --> Modules
%% Styling
style CLI stroke:#000,stroke-width:2px
style M1 stroke:#000,stroke-width:2px
style M2 stroke:#000,stroke-width:2px
style M3 stroke:#000,stroke-width:2px
style M4 stroke:#000,stroke-width:2px
style Edit stroke:#000,stroke-width:2px
style CSV stroke:#000,stroke-width:2px
style Analysis stroke:#000,stroke-width:2px
style Template stroke:#000,stroke-width:2px
style Excel stroke:#000,stroke-width:2px
style Assets stroke:#000,stroke-width:2px
style Output stroke:#000,stroke-width:2px
style Deps stroke:#000,stroke-width:2px
style Menu stroke:#000,stroke-width:2px
style Modules stroke:#000,stroke-width:2px
style Dirs stroke:#000,stroke-width:2px
- Clone or create the project:
git clone https://github.com/Not-Buddy/CertificateMakerRust.git
cd CertificateMaker
- Set up the project structure:
mkdir -p excelcsvs Template assets certificates output
-
Add your files:
- Put PNG templates in
Template/ - Put CSV files with names in
excelcsvs/ - Put font files in
assets/
- Put PNG templates in
-
Build and run:
cargo run
CertificateMaker/
βββ src/
β βββ main.rs # Main application with menu system
β βββ analysis.rs # PNG file analysis functionality
β βββ editpng.rs # Image editing and text overlay
β βββ csvexcelparser.rs # CSV parsing and certificate generation
βββ excelcsvs/ # CSV files with names
β βββ Names.csv
βββ Template/ # PNG template files
β βββ certificate.png
βββ assets/ # Font files
β βββ Arial.ttf
β βββ DejaVuSans.ttf
βββ certificates/ # Generated certificates (auto-created)
βββ output/ # Single image outputs (auto-created)
βββ Cargo.toml
βββ README.md
- Add text to single image - Add custom text to any template
- Generate certificates from CSV - Batch create certificates
- Analyze PNG file - Get detailed image information
- Create sample CSV - Generate example CSV files
- Debug CSV file - Troubleshoot CSV formatting issues
- Debug template file - Analyze template properties
- Debug font files - Check available fonts
- Show file organization tips - Help with file structure
- Prepare your CSV file (
excelcsvs/Names.csv):
Name
Alice Johnson
Bob Smith
Charlie Brown
Diana Prince
Eva Martinez
-
Add templates to
Template/directory (PNG/JPG files) -
Add fonts to
assets/directory (TTF/OTF files) -
Run the program:
cargo run
-
Select option 2 (Generate certificates)
-
Follow the interactive prompts:
- Select CSV file from list
- Choose template from available options
- Pick font from assets directory
- Set position (or use center default)
- Choose font size and color
- Specify output directory
- Automatically scans
assets/directory - Supports TTF, OTF, WOFF, WOFF2 formats
- Interactive selection by number or name
- Hex colors:
#FF0000,#00FF00AA(with alpha) - Named colors: white, black, red, green, blue, yellow, orange, purple
- Manual coordinates: Specify exact X,Y positions
- Auto-center: Leave blank to center text
- Template analysis: Get suggested coordinates
Your CSV files must have a "Name" column:
Name
John Doe
Jane Smith
Alice Johnson
Supported variations:
- Column names:
Name,name,NAME - File location:
excelcsvs/directory - Format: Standard CSV with headers
[dependencies]
image = "0.24"
png = "0.17"
anyhow = "1.0"
imageproc = "0.23"
rusttype = "0.9"
csv = "1.3"
serde = { version = "1.0", features = ["derive"] }
π === Certificate Generator (CSV Files Only) ===
π Available CSV Files in 'excelcsvs' directory:
1. Names.csv
2. Students.csv
Select CSV file: 1
β
Selected: Names.csv
πΌοΈ Available Template Files in 'Template' directory:
1. certificate.png
2. diploma.png
Select template file: 1
β
Selected template: certificate.png
π€ Available Font Files in 'assets' directory:
1. Arial.ttf
2. DejaVuSans.ttf
Select font file: 2
β
Selected font: DejaVuSans.ttf
π Generating 5 certificates...
β
Generated certificate 1/5: Alice Johnson
β
Generated certificate 2/5: Bob Smith
β
Generated certificate 3/5: Charlie Brown
β
Generated certificate 4/5: Diana Prince
β
Generated certificate 5/5: Eva Martinez
π Certificate generation complete!
π Certificates saved in: certificates
"Directory not found" errors:
- Ensure you've created the required directories:
excelcsvs/,Template/,assets/ - Use option 8 to see file organization tips
"No CSV files found":
- Put CSV files in the
excelcsvs/directory - Use option 4 to create a sample CSV file
"Failed to parse CSV":
- Ensure your CSV has a "Name" column header
- Use option 5 to debug CSV file issues
Font loading errors:
- Put font files (.ttf, .otf) in the
assets/directory - Use option 7 to check available fonts
- Option 5: Debug CSV files - shows file content and parsing issues
- Option 6: Debug templates - shows image properties and suggested coordinates
- Option 7: Debug fonts - lists available fonts with file sizes
- Recommended formats: PNG (preferred), JPG, JPEG
- Recommended size: 1200x800 pixels or larger
- Design tips: Leave space for text overlay (usually center or bottom third)
- File location:
Template/directory
- Fork the project
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Install Rust
- Create project directories (
excelcsvs/,Template/,assets/) - Add a CSV file with names to
excelcsvs/ - Add PNG templates to
Template/ - Add font files to
assets/ - Run
cargo runand select option 2 - Generate your first batch of certificates! π
For questions or issues, please check the troubleshooting section or create an issue in the repository.
This README provides:
1. **Clear project overview** with features
2. **Step-by-step setup instructions**
3. **Complete project structure**
4. **Detailed usage examples**
5. **Troubleshooting guide**
6. **File format specifications**
7. **Customization options**
8. **Professional formatting with emojis**
The README is comprehensive enough for new users to get started quickly while providing enough detail for advanced usage!