@@ -452,54 +452,58 @@ Poster thumbnails and people photos use hand-drawn green borders for visual cons
452452### Border Script Usage
453453
454454``` bash
455- # Basic usage
456- python scripts/add_borders.py < input_dir> < output_dir>
457-
458- # Example: Process new poster images
459- python scripts/add_borders.py images/publications/new/ images/publications/
460-
461- # Example: Process a single image (copy to temp folder first)
462- mkdir temp_input
463- cp images/publications/MyPoster.png temp_input/
464- python scripts/add_borders.py temp_input/ temp_output/
465- mv temp_output/MyPoster.png images/publications/MyPoster.png
466- rm -rf temp_input temp_output
455+ # Process a single image
456+ python scripts/add_borders.py photo.png output_dir/
457+
458+ # Process multiple images
459+ python scripts/add_borders.py img1.png img2.jpg img3.png output_dir/
460+
461+ # Process a directory of images
462+ python scripts/add_borders.py input_dir/ output_dir/
463+
464+ # Use face detection for smart cropping (recommended for profile photos)
465+ python scripts/add_borders.py photo.jpg output_dir/ --face
467466```
468467
469468### How It Works
470469
471470The script:
4724711 . Loads 10 hand-drawn border designs from ` images/templates/WebsiteDoodles_Posters_v1.svg `
473- 2 . For each input PNG, selects a random border
474- 3 . Resizes the image to fit inside the border frame (poster extends to middle of border lines)
475- 4 . Composites the border on top of the image
476- 5 . Makes areas outside the border transparent
477- 6 . Outputs a 500x500 PNG with ~ 41px transparent margins
472+ 2 . For each input image (PNG, JPG, JPEG):
473+ - Crops to square (centered, or face-centered with ` --face ` )
474+ - Resizes if larger than 1000px (preserving aspect ratio)
475+ - Selects a random border
476+ - Composites the border on top of the image
477+ - Makes areas outside the border transparent
478+ 3 . Outputs a 500x500 PNG with ~ 41px transparent margins
478479
479480### Adding New Poster Thumbnails
480481
481- 1 . Create a thumbnail PNG of the poster (any size, will be resized)
482- 2 . Place in a temporary input folder
483- 3 . Run the border script
484- 4 . Move the output to ` images/publications/ `
485- 5 . Update ` data/publications.xlsx ` with the image filename
482+ ``` bash
483+ # Direct processing - no temp folders needed
484+ python scripts/add_borders.py MyPoster.png images/publications/
485+ ```
486+
487+ Then update ` data/publications.xlsx ` with the image filename.
486488
487489### Adding New People Photos
488490
489- 1 . Prepare the photo as a PNG (square crop recommended)
490- 2 . Place in a temporary input folder
491- 3 . Run the border script
492- 4 . Move the output to ` images/people/ `
493- 5 . Update ` data/people.xlsx ` with the image filename
491+ ``` bash
492+ # Use --face for automatic face-centered cropping
493+ python scripts/add_borders.py photo.jpg images/people/ --face
494+ ```
495+
496+ Then update ` data/people.xlsx ` with the image filename.
494497
495498### Script Options
496499
497500``` bash
498501python scripts/add_borders.py --help
499502
500503Options:
501- input_dir Directory containing input PNG files
504+ inputs Input PNG/JPG files or directories (one or more)
502505 output_dir Directory to save output files
506+ --face Use face detection to center crop on detected face
503507 --border-svg Path to SVG with border designs (default: images/templates/WebsiteDoodles_Posters_v1.svg)
504508 --output-size Output image size in pixels (default: 500)
505509```
@@ -510,6 +514,7 @@ The script requires:
510514- Python 3
511515- PIL/Pillow
512516- NumPy
517+ - mediapipe (for ` --face ` option; model downloads automatically on first use)
513518- ` rsvg-convert ` (from librsvg, install via ` brew install librsvg ` on macOS)
514519
515520## Mobile Responsiveness
0 commit comments