2026-01-30 23:11:31 +03:30
2026-01-30 23:11:31 +03:30
2026-01-30 23:11:31 +03:30
2026-01-30 23:11:31 +03:30
2026-01-30 23:11:31 +03:30
2026-01-30 23:11:31 +03:30

Rename and compress phone photos

Python scripts to change file names from phone to their original date and create a compressed version of them.

Photo and Video Renaming Tool

Rename photos from phone gallery based on their EXIF metadata.

Features

  • Renames JPG, JPEG, and HEIC photos based on 'Date Time Original' EXIF metadata
  • Renames MP4, MOV, and M4V videos based on container creation time
  • Format: yyyymmdd_hhmmss (e.g., 20221227_162232.jpg)
  • Handles duplicate names by adding numeric suffixes (_1, _2, etc.)
  • Processes directories recursively
  • Skips macOS resource fork files (._*)
  • Dry-run mode to preview changes before applying

Installation

# Install Python dependencies
pip install -r requirements.txt

# Install ffmpeg for video support (macOS)
brew install ffmpeg

# Or on Linux:
# sudo apt-get install ffmpeg  # Debian/Ubuntu
# sudo yum install ffmpeg      # RedHat/CentOS

Usage

Preview changes (dry-run mode):

python rename_photos.py <directory> --dry-run

Rename photos:

python rename_photos.py <directory>

Examples:

# Preview what would be renamed in Sample Media folder
python rename_photos.py "Sample Media" --dry-run

# Actually rename files
python rename_photos.py "Sample Media"

Notes

  • Files that already match the yyyymmdd_hhmmss format will be skipped
  • Photos without 'Date Time Original' EXIF metadata will be skipped
  • Videos without creation_time metadata will be skipped
  • The script preserves the original file extension (case-insensitive)
  • Works recursively through all subdirectories

Photo Compression Tool

Create reduced-size compressed versions of photos (skips videos).

Features

  • Compresses JPG, JPEG, and HEIC photos
  • Resizes images while preserving aspect ratio
  • Maintains directory structure in output folder
  • Converts all images to JPEG format
  • Configurable maximum dimension and quality
  • Skips already compressed files

Usage

python compress_photos.py <input_directory> <output_directory> [max_dimension] [quality]

Arguments:

  • input_directory - Directory containing photos to compress
  • output_directory - Directory to save compressed photos
  • max_dimension - Maximum width/height in pixels (default: 1920)
  • quality - JPEG quality 1-100 (default: 85)

Examples

# Compress with default settings (1920px, quality 85)
python compress_photos.py "Photos" "Photos_Compressed"

# Compress to 1280px max dimension with quality 80
python compress_photos.py "Photos" "Photos_Compressed" 1280 80

# High quality compression for web (2560px, quality 90)
python compress_photos.py "Photos" "Photos_Web" 2560 90

Notes

  • Videos are automatically skipped
  • All images are converted to JPEG format
  • Directory structure from input is preserved in output
  • Existing files in output directory are skipped
Description
Python scripts to change file names from phone to their original date and create a compresses version of them
Readme 31 KiB
Languages
Python 100%