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.txtProcess 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" --partialCustom output size and word height:
python quick_cuts.py images/*.jpg -w "news" -s 1920x1080 --word-height 150Specify output directory:
python quick_cuts.py images/ -w "alert" -o output_folderUse 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.
New: Quick Cuts can now fetch related articles/posts for a keyword so you can keep research and creation in one place.
- Sources (no API keys required): Google News RSS, Bing News RSS, Hacker News
- Output: normalized items with fields: source, title, url, snippet, published_at
Dependencies
- Ensure these are installed (already added to requirements):
- requests>=2.31.0
- feedparser>=6.0.10
Quick start (Python IPC example)
import json, subprocess, sys
# Start backend
p = subprocess.Popen([sys.executable, 'backend_service.py'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
print('Startup:', p.stdout.readline().strip())
# Send scrape command
cmd = {"command": "scrape_content", "query": "OpenAI", "limit": 5, "sources": ["news", "hn"]}
p.stdin.write(json.dumps(cmd) + "\n"); p.stdin.flush()
print('Response:', p.stdout.readline().strip())
# Shutdown backend
p.stdin.write(json.dumps({"command": "shutdown"}) + "\n"); p.stdin.flush()
print('Shutdown:', p.stdout.readline().strip())Command parameters
- query (string, required): keyword/phrase to search
- limit (int, optional, default 10): max items per source (1–50)
- sources (list or comma-separated string, optional):
- "news" -> Google News + Bing News RSS
- "hn" -> Hacker News (Algolia)
Notes
- The backend will reply with an error if dependencies are missing.
- Network calls use timeouts; some sources may occasionally fail—errors are handled per source so others can still return results.
