Programming and writing about it.

echo $RANDOM

Links for today: Web 2.0, Mashups, Podcasts

Shell script to rotate a bunch of Images


#!/bin/bash
# Uses the 'convert' utility to rotate a bunch of images via some specified angle in
# clockwise
# By Amit K.Saha

# Angle is to be supplied as a command line parameter
#./Rotate.sh 90

for i in *.png
do
convert -rotate $1 $i $i
done

Shell Scipt to convert a bunch of images using ‘convert’

convert is a command line tool available with ImageMagick which can be used to convert between image formats. This shell script uses it to convert a bunch of images from ‘.ps’ to ‘.png’. Follow embedded instructions to customize it to your needs.


#!/bin/bash

# Uses the 'convert' utility to convert a bunch of images from one
#format to another
# the script should reside in the same directory as the images
# You need to have 'ImageMagick' installed
#(http://www.imagemagick.org/index.php)

# By Amit K.Saha
# Help taken from http://howtoforge.com/forums/showthread.php?t=4493

#to convert to/from different formats
# change 'ext' to reflect the format you want to convert "from"
# Chnage target to the format you want to convert to

ext=".ps"
target="png"

for i in *.ps
do
base=$(basename $i $ext) #to extract only the filename and NOT the extension
convert $i $base.$target

done
Advertisement