A fast CLI tool to prepare images for Instagram publishing, optimized for Apple Silicon.
Automatically processes images to meet Instagram's optimal specifications:
- Portrait images: Center-cropped to 4:5 ratio, scaled to 1080×1350px
- Landscape images: Scaled to max 1350px long edge (preserves aspect ratio)
- Square images: Scaled to 1080×1080px
- All images:
- Subtle sharpening for screen viewing (can be disabled with
--no-sharpen) - Converted to sRGB color space
- Saved as progressive JPEG with optimized quality
- Automatically reduced to stay under 8MB file size limit
- EXIF data stripped for privacy (use
--keep-exifto preserve GPS/DateTime)
- Subtle sharpening for screen viewing (can be disabled with
- Clone or navigate to this directory
- Install with Poetry:
poetry install- The
prepforinstacommand will be available in your Poetry environment
Process all images in a folder (outputs to INPUT_FOLDER/INSTA):
prepforinsta ~/pictures/vacationprepforinsta ~/pictures/vacation ~/pictures/ready-for-instagramprepforinsta ~/pictures/vacation/IMG_1234.jpgprepforinsta [INPUT_PATH] [OUTPUT_PATH] [OPTIONS]
Options:
--quality INTEGER RANGE Starting JPEG quality (60-100). Auto-reduces if
needed to meet 8MB limit. [default: 100]
--no-sharpen Skip sharpening (useful if images are pre-sharpened
in Lightroom)
--keep-exif Preserve GPS and DateTime EXIF data (stripped by
default for privacy)
--max-size FLOAT Target max file size in MB. Enables size-constrained
mode (no cropping, preserves aspect ratio)
-f, --force Overwrite existing output files (skipped by default)
--dry-run Show what would be processed without processing
-v, --verbose Show detailed processing information
--help Show this message and exitDry run to see what will be processed:
prepforinsta ~/pictures/vacation --dry-runVerbose output with detailed info:
prepforinsta ~/pictures/vacation -vCustom quality starting point:
prepforinsta ~/pictures/vacation --quality 95Skip sharpening (for pre-sharpened exports):
prepforinsta ~/pictures/vacation --no-sharpenKeep GPS/DateTime for Instagram auto-location:
prepforinsta ~/pictures/vacation --keep-exifSize-constrained mode for PurplePort (6MB limit):
prepforinsta ~/pictures/vacation --max-size 6When using --max-size, the tool operates in size-constrained mode:
- No cropping - preserves original aspect ratio
- No fixed dimensions - scales down to fit within size limit
- Balances quality + resolution - reduces both for optimal result
This is useful for platforms like PurplePort that have file size limits but don't require specific aspect ratios.
- JPEG (.jpg, .jpeg)
- PNG (.png)
- Detects orientation: Classifies each image as portrait, landscape, or square
- Crops/scales appropriately:
- Portrait: Center crop to 4:5, then scale to 1080×1350px
- Landscape: Scale down so longest edge is 1350px
- Square: Scale to 1080×1080px
- Color correction: Converts to sRGB (Instagram's standard color space)
- Sharpening: Applies subtle unsharp mask for screen viewing (skip with
--no-sharpen) - EXIF handling: Strips all metadata for privacy (use
--keep-exifto preserve GPS/DateTime) - Size optimization: Saves as progressive JPEG, automatically reducing quality if needed to stay under 8MB
This tool handles the technical requirements, but for best results:
- Before export from Lightroom: Apply your full editing workflow as normal
- Export settings from Lightroom: Full resolution, high quality, light sharpening for matte prints
- Run this tool: Handles Instagram-specific sizing, color space, and screen sharpening
- Upload to Instagram: Images will be optimized for the platform with minimal quality loss
- 4:5 portrait ratio: Instagram's maximum portrait ratio, gives you the most screen real estate
- 1350px max: Instagram's recommended maximum dimension
- Progressive JPEG: Better loading experience on mobile
- sRGB color space: Instagram converts to sRGB anyway; doing it upfront gives you more control
- Screen sharpening: Compensates for Instagram's compression while avoiding oversharpening
- 8MB limit: Instagram's file size maximum
- Built with Pillow for fast image processing on Apple Silicon
- Click for modern CLI interface
- piexif for EXIF metadata handling
- Optimized for Apple Silicon Macs with native ARM64 wheels
MIT