Skip to content

Instantly share code, notes, and snippets.

@AndyA
Created June 26, 2014 16:39
Show Gist options
  • Select an option

  • Save AndyA/e7a51a05082220a41cd4 to your computer and use it in GitHub Desktop.

Select an option

Save AndyA/e7a51a05082220a41cd4 to your computer and use it in GitHub Desktop.
#!/bin/bash
ind="full"
for sz in "223x293"; do
find "$ind" -iname '*.png' | while read src; do
dst="${src/$ind/$sz}"
if [ "$src" -nt "$dst" ]; then
echo "$src -> $dst"
mkdir -p "$(dirname "$dst")"
tmp="$dst.tmp.png"
convert "$src" -resize "$sz" "$tmp" && mv "$tmp" "$dst"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment