Skip to content

Instantly share code, notes, and snippets.

@victorlin
Last active August 16, 2024 22:54
Show Gist options
  • Select an option

  • Save victorlin/efd30d0d2a617876330a355278b69efc to your computer and use it in GitHub Desktop.

Select an option

Save victorlin/efd30d0d2a617876330a355278b69efc to your computer and use it in GitHub Desktop.
Script to convert and downsize RAW photos to small JPG files for fast Google Drive upload

Overview

Script to convert and downsize RAW images. Good for web uploading.

  1. Convert all .CR2 files (RAW) to jpg
  2. Downsize image dimensions by 25%
  3. Move to new directory jpg

Quickstart

cd path/to/directory_with_cr2
bash batch-cr2-jpg-downsize.sh

Requirements

  • sips
  • mogrify
for i in *.CR2; do sips -s format jpeg $i --out "${i%.*}.jpg"; done
mogrify -resize 25% *.jpg
mkdir jpg
mv *.jpg jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment