Skip to content

Not-Buddy/CertiForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# πŸŽ“ 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
Loading

Installation

  1. Clone or create the project:
git clone https://github.com/Not-Buddy/CertificateMakerRust.git
cd CertificateMaker
  1. Set up the project structure:
mkdir -p excelcsvs Template assets certificates output
  1. Add your files:

    • Put PNG templates in Template/
    • Put CSV files with names in excelcsvs/
    • Put font files in assets/
  2. Build and run:

cargo run

πŸ“ Project Structure

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

🎯 Usage

Main Menu Options

  1. Add text to single image - Add custom text to any template
  2. Generate certificates from CSV - Batch create certificates
  3. Analyze PNG file - Get detailed image information
  4. Create sample CSV - Generate example CSV files
  5. Debug CSV file - Troubleshoot CSV formatting issues
  6. Debug template file - Analyze template properties
  7. Debug font files - Check available fonts
  8. Show file organization tips - Help with file structure

Creating Certificates

  1. Prepare your CSV file (excelcsvs/Names.csv):
Name
Alice Johnson
Bob Smith
Charlie Brown
Diana Prince
Eva Martinez
  1. Add templates to Template/ directory (PNG/JPG files)

  2. Add fonts to assets/ directory (TTF/OTF files)

  3. Run the program:

cargo run
  1. Select option 2 (Generate certificates)

  2. 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

🎨 Customization Options

Font Selection

  • Automatically scans assets/ directory
  • Supports TTF, OTF, WOFF, WOFF2 formats
  • Interactive selection by number or name

Color Options

  • Hex colors: #FF0000, #00FF00AA (with alpha)
  • Named colors: white, black, red, green, blue, yellow, orange, purple

Positioning

  • Manual coordinates: Specify exact X,Y positions
  • Auto-center: Leave blank to center text
  • Template analysis: Get suggested coordinates

πŸ“‹ CSV File Format

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

[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"] }

🎯 Examples

Example Certificate Generation

πŸŽ“ === 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

Example Output

πŸŽ“ 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

πŸ”§ Troubleshooting

Common Issues

"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

Debug Tools

  • 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

🎨 Template Guidelines

  • 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

🀝 Contributing

  1. Fork the project
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸš€ Getting Started Checklist

  • 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 run and 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!