Bash Shell Script Image Thumbnail Creation

2008-05-29


Creating thumbnails automatically

Here is a quick bash script that will automatically generate thumbnails in a series of images in multiple subdirectories...

#!/bin/bash

for img in `find . -name '*.jpg'`
do
 convert -resize 15% $img $img._thumb.jpg
 x=$(echo $img._thumb.jpg|sed 's/\.jpg.//g')
 mv $img._thumb.jpg $x
done


And to convert from one format to another ...



#!/bin/bash

for img in `find . -name '*.jpg'`
do
 convert $img $img.ppm
 x=$(echo $img.ppm|sed 's/\.jpg//g')
 mv $img.ppm $x
done