Skip to main content
added 2 characters in body
Source Link
Stéphane Chazelas
  • 584.7k
  • 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.bak"back" &&
         convert -resize "1000x1000>" "$file.bak"back" "$file" &&
         touch -r "$file.back" "$file"
     done' sh

Here resizing the images so they bitfit 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

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.bak" &&
         convert -resize "1000x1000>" "$file.bak" "$file" &&
         touch -r "$file.back" "$file"
     done' sh

Here resizing the images so they bit 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

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
Source Link
Stéphane Chazelas
  • 584.7k
  • 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.bak" &&
         convert -resize "1000x1000>" "$file.bak" "$file" &&
         touch -r "$file.back" "$file"
     done' sh

Here resizing the images so they bit 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