A Python tool that automatically aligns and centers specific words in images using OCR.
Perfect for creating that "busy" effect in documentary-style videos.
- 🔍 OCR-powered word detection - Automatically finds target words in images
- 🎯 Automatic centering - Centers the detected word in the output frame
- 📐 Consistent sizing - Maintains uniform word size across all images
- ⚡ Parallel processing - Processes multiple images simultaneously for speed
- 🔤 Partial matching - Optionally match partial words (e.g., "warp" matches "warpdotdev")
- 📁 Batch processing - Process entire folders of images at once
- Python 3.8 or higher
- Tesseract OCR installed on your system
- Windows: Download installer from GitHub releases
- Mac:
brew install tesseract
- Linux:
sudo apt-get install tesseract-ocr
# Clone the repository
git clone https://github.com/yourusername/quick-cuts.git
cd quick-cuts
# Install dependencies with uv
uv pip install -r requirements.txt
# Clone the repository
git clone https://github.com/yourusername/quick-cuts.git
cd quick-cuts
# Install dependencies
pip install -r requirements.txt
Process images with a specific word:
python quick_cuts.py images/*.png -w "breaking"
Process a folder with partial matching:
python quick_cuts.py images/ -w "warp" --partial
Custom output size and word height:
python quick_cuts.py images/*.jpg -w "news" -s 1920x1080 --word-height 150
Specify output directory:
python quick_cuts.py images/ -w "alert" -o output_folder
Use multiple workers for faster processing:
python quick_cuts.py images/ -w "update" --workers 8
Option | Description | Default |
---|---|---|
images |
Input image file(s) or directory | Required |
-w, --word |
Target word to center | Required |
-o, --output |
Output directory | ./aligned_[word] |
-s, --size |
Output image size | 1920x1080 |
--word-height |
Target height for word in pixels | 100 |
--partial |
Enable partial word matching | False |
--workers |
Number of parallel workers | CPU count |
--background |
Background color (white/black/transparent) | white |
- OCR Detection: The tool uses Tesseract OCR to detect text in each image
- Word Location: Finds the target word and its bounding box
- Alignment Calculation: Calculates the transformation needed to center the word
- Image Generation: Creates a new image with the word perfectly centered
- Batch Processing: Processes all images in parallel for efficiency
The tool creates aligned images with consistent properties:
- All images have the same resolution
- Target word is centered in every frame
- Word size is consistent across all images
- Original aspect ratios are preserved where possible
Output files are saved as aligned_[original_filename]
in the output directory.
- Image Quality: Higher resolution images produce better OCR results
- Text Clarity: Ensure text is clear and readable in source images
- Contrast: Good contrast between text and background improves detection
- Preprocessing: The tool automatically applies image preprocessing, but very poor quality images may still fail
- Ensure Tesseract is properly installed and in your PATH
- Try adjusting the confidence threshold in the code
- Check that the text is clear and readable in your images
- The tool handles Unicode characters in filenames automatically
- If issues persist, try renaming files to use only ASCII characters
- Reduce the number of workers if you experience memory issues
- Process images in smaller batches for very large datasets
This tool is perfect for creating dynamic news-style cuts where specific words need to be emphasized:
- Export frames from your video clips
- Run quick_cuts to align all frames on your target word
- Import the aligned images into Premiere/After Effects
- Create smooth transitions between different clips with the word always centered
MIT License - feel free to use this tool for any purpose!
Contributions are welcome! Please feel free to submit a Pull Request.