How to annotate text on image files?

Dear Sir,
The problem description as follows
I have a folder named abc with files of different extensions such as:

bcsu.txt
hsdk.prot
ajia.sh
sai.hm
abcd_1213_saj.png

I am supposed to write a bash script which reads all the .png files
and read the 6th7th8th9th(word/numerals) here it is 1213
and add it on the bottom of the same image file.So that when we open the image file
abcd_1213_saj.png , we could see the 1213 on the bottom line
This script should read all the png files in the defined folder do the same task.

Please tell us about .png files . Are they a simple text format suitable for processing in Shell Tools or some other format which needs special programming?

a simple text format is enough....no special effects or programming is required

In that case it can't be Portable Network Graphics format (a format which is unsuitable for editing with test-based tools).

You probably need a script someting like this:

#!/bin/bash
cd abc
ls -1d *\.png | while read filename
do
      # make sure it is a proper file
      if [ -f "${filename}" ]
      then
           numerals=$(echo ${filename}|cut -c6-9)
           # For testing, work on a copy of each file
           # Copy the file
           cp -p "${filename}" "${filename}.sav"
           # Append the text 
           echo "${numerals}" >> "${filename.sav}"
     fi
done

its not reading the 6th to 9th numerals......

---------- Post updated 07-26-12 at 03:08 AM ---------- Previous update was 07-25-12 at 11:53 PM ----------

#!/bin/bash
FILES=/home/balnair/transfer/Images/test/*
for f in $FILES
do
  echo "Processing $f file....."
 
         numerals=$(echo ${f}|cut -c56-59)
  
  
        echo "$numerals" 
  
 
convert $FILES -font courier -fill white -pointsize 20 -annotate +50+50 '$numerals'  $numerals.jpg

done

There are some issues facing in the above script

1.script could able to get the numeras , but unable to annotate on the image
2.multiple files are being wriiten for a particular png files

what could be done?...wht shoud be the modification in this script?

Thanks in advance

I'm not sure what you mean.

Could you give an example of what's happening?