User:Ojw/bash

From OpenStreetMap Wiki
Jump to navigation Jump to search

Rotate a directory full of images

for i in *; do convert -rotate 90 $i $i; done

Convert a directory full of mixed graphics to a common file format

OUTDIR="symbols"
SIZE="40"

rm -rf ${OUTDIR}
mkdir ${OUTDIR}

for file in *.png 
do
convert ${file} -resize ${SIZE}x${SIZE} ${OUTDIR}/${file} 
done

for file in *gif
do
convert ${file} -resize ${SIZE}x${SIZE} ${OUTDIR}/${file}.png
done

for file in *svg
do
rsvg -w ${SIZE} -h ${SIZE} -f png ${file} ${OUTDIR}/${file}.png
done

echo "New iconset of size ${SIZE} was created in ${OUTDIR}"