Skip to content

Instantly share code, notes, and snippets.

@biiont
Created October 1, 2015 10:07
Show Gist options
  • Save biiont/be88ebb6f1b04b0f91e9 to your computer and use it in GitHub Desktop.
Save biiont/be88ebb6f1b04b0f91e9 to your computer and use it in GitHub Desktop.
Batch image resample
#!/bin/sh
# This script allows to resample images from whatever DPI to 75 DPI (screen resolution)
# in batch. I use it to prepare smallsize images of scans of my IDs, etc...
cd path/to/collections/base/dir
for fi in $(/bin/ls -1 image_collection_600dpi/*)
do
fo="$(echo $fi | sed 's/_[[:digit:]]\+dpi//g')"
echo convert-im6 $fi -units PixelsPerInch -resample 75 $fo
done
# Oneline
cd ~/org/id
for fi in $(/bin/ls -1 passeport_600dpi/*); do fo="$(echo $fi | sed 's/_[[:digit:]]\+dpi//g')"; echo convert-im6 $fi -units PixelsPerInch -resample 75 $fo; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment