Create custom fonts from alphabet images with automatic character segmentation and vector tracing.
The Font Generator wizard transforms alphabet images into installable font files (TTF/OTF). It automatically segments individual characters, converts them to vector outlines, and builds a complete font with proper metrics.
- Open ImageAI and go to Tools > Font Generator
- Upload an image containing your alphabet characters
- Review and adjust character segmentation
- Verify character mappings
- Configure font settings
- Preview and export to TTF/OTF
Upload an image containing your alphabet characters. The wizard supports various arrangements:
Supported Formats: PNG, JPEG, BMP, TIFF
Image Requirements:
- Characters arranged in rows with clear spacing
- Dark characters on light background (or enable Invert)
- Consistent character sizing works best
- Higher resolution produces better quality fonts
Character Set Selection:
- Uppercase (A-Z) - 26 characters
- Lowercase (a-z) - 26 characters
- Uppercase + Lowercase - 52 characters
- Uppercase + Digits - 36 characters
- Full (A-Z, a-z, 0-9) - 62 characters
- Custom - Enter your own character set
The wizard detects individual characters using one of three methods:
Segmentation Methods:
| Method | Best For | Description |
|---|---|---|
| Contour-based | Irregular spacing | Detects character outlines automatically |
| Grid-based | Uniform grids | Divides image into rows and columns |
| Auto Detect | Unknown layouts | Tries both and selects best result |
Adjustment Options:
- Invert - Toggle for light text on dark background
- Padding - Add spacing around detected characters
- Grid Rows/Cols - Manual grid specification (grid mode only)
- Re-analyze - Rerun detection with current settings
Visual Feedback:
- Red bounding boxes show detected characters
- Status displays found vs expected character count
- Warnings highlight potential issues
Review and correct the automatic character assignments:
- Each detected character is shown with its image and label
- Click the label field to change the assigned character
- Scroll through all detected characters to verify accuracy
- Fix any misidentified characters before proceeding
Common Issues:
- Similar characters confused (I/l/1, O/0, etc.)
- Wrong order due to detection sequence
- Missing characters from unclear source image
Configure your font's metadata and quality settings:
Font Information:
- Font Family - The name users will see (e.g., "MyCustomFont")
- Style - Regular, Bold, Italic, or Light
- Version - Semantic version (e.g., "1.0")
- Designer - Your name (optional)
- Copyright - Copyright notice (optional)
Vectorization Quality:
| Smoothing | Effect | Best For |
|---|---|---|
| None | Maximum detail | Already smooth source images |
| Low | Slight cleanup | Clean source with minor noise |
| Medium | Balanced | General purpose |
| High | Heavy smoothing | Rough or hand-drawn sources |
| Maximum | Aggressive | Very rough sources |
Export Format:
- TrueType (.ttf) - Most compatible across systems
- OpenType (.otf) - Advanced typography features
Preview your font with sample text and export:
Preview:
- Enter custom sample text to preview
- Font is rendered using the actual generated font
- Check character spacing and visual quality
Export:
- Click Export Font... to save
- Choose destination folder and filename
- Both TTF and OTF can be exported simultaneously
Characters are converted from bitmap to vector using:
- Contour Detection - OpenCV finds character outlines
- Path Simplification - Reduces point count while preserving shape
- Bezier Fitting - Converts to smooth curves
- Smoothing - Applies selected smoothing level
The generator automatically calculates:
- Units Per Em - Standard 1000 units
- Ascender/Descender - Vertical bounds
- Baseline - Character alignment
- Advance Width - Character spacing
- Bounding Boxes - Per-character dimensions
The Font Generator requires fonttools for font building:
pip install fonttoolsIf fonttools is not installed, export will be disabled with a warning.
- Use high resolution - 300 DPI or higher
- Maintain consistency - Same size and style for all characters
- Clean backgrounds - Solid white or transparent works best
- Sufficient spacing - Characters shouldn't touch
- Clear forms - Avoid very thin strokes
Recommended Layout:
A B C D E F G
H I J K L M N
O P Q R S T U
V W X Y Z
For Grid-based Segmentation:
- Use exact rows and columns
- Equal spacing between characters
- No extra margins or decorations
| Source Type | Recommended Smoothing |
|---|---|
| Clean vector-style | None or Low |
| High-res photograph | Low or Medium |
| Hand-drawn/scanned | Medium or High |
| Rough sketch | High or Maximum |
Symptoms: "Found X of Y characters" shows mismatch
Solutions:
- Adjust Invert setting if text is light on dark
- Increase Padding if characters are merging
- Switch to Grid-based method with explicit rows/cols
- Verify source image has all expected characters
Symptoms: Jagged edges, missing details, distorted shapes
Solutions:
- Use higher resolution source image
- Reduce Smoothing level to preserve detail
- Check that source characters have clear edges
- Ensure sufficient contrast in source image
Symptoms: Error message on export
Solutions:
- Install fonttools:
pip install fonttools - Check write permissions for output directory
- Ensure filename doesn't contain special characters
- Try exporting to a different location
Symptoms: Some characters missing from segmentation
Solutions:
- Check image has sufficient contrast
- Try Invert if using light-on-dark text
- Reduce Padding if it's excluding small characters
- Use Grid-based method for uniform layouts
Default Export Directory:
- Windows:
%APPDATA%\ImageAI\Fonts\ - macOS:
~/Library/Application Support/ImageAI/Fonts/ - Linux:
~/.config/ImageAI/Fonts/
Settings Persistence: All wizard settings are saved and restored between sessions.
- Prepare Image: Create alphabet in image editor with consistent styling
- Upload: Select image and choose "Uppercase (A-Z)"
- Segment: Use Contour-based with Invert OFF, Padding 2
- Verify: Check all 26 characters are correctly labeled
- Configure: Name "MyHandwriting", Style "Regular", Smoothing "Low"
- Preview: Type sample text to verify appearance
- Export: Save as "MyHandwriting.ttf"
Part of ImageAI v0.32.0 | GitHub Repository