Skip to main content
2 of 2
added 2 characters in body
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k

You could always do it with a bit of scripting:

exiftool  -q -r -ext jpg -if '
    $ImageWidth > 1000 ||
    $ImageHeight > 1000 and
      !print "$Directory/$Filename\0"' . |
  xargs -r0 sh -c '
    for file do
      mv -i "$file" "$file.back" &&
        convert -resize "1000x1000>" "$file.back" "$file" &&
        touch -r "$file.back" "$file"
    done' sh

Here resizing the images so they fit into a bounding box of 1000x1000.

  • exiftool is used to find the images that need resizing
  • convert resizes them (doesn't touch the exif info)
  • touch -r restores the original timestamp from the backup file
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k