views:

73

answers:

0

What this is meant to do is, collects the arguments which are the names of the image files and checks them if they exist and are readable, then it converts the image to the preview file in the layout (imagename)_preview.jpg and underneath it it would have the size of the orignal file in 'bytes'. Here is my script.

#!/bin/sh
clear
for i in $*
do
    if [ $# -gt 5 ]
    then
        echo -e "It can't be no more than 5 arguments are allowed"
        exit 1
    else
        if [ -e $i ]
        then
            if [ -r $i ]
            then
                size=$(identify -format '%b' "$i")
                iname=${i%.*}_preview.jpg
                convert -resize 200x200\> $i -background Khaki -font Arial -pointsize 18 \
                label:$size' bytes' -gravity Center -append $iname
                display $iname &
            else
                echo -e "The file '$i' isn't readable!"
            fi
        else
            echo -e "The file '$i' doesn't exist!"
        fi
    fi
done

The errors that im getting is first that i got a identify error and a convert error

convert: unable to read font '/usr/share/fonts/default/TrueType/arial.ttf'

and if there are any errors please correct me. Thanks