The ImageMagick graphics tools (included with most distributions) contain the tools to do this. For example:
Code:
mogrify -comment "test" /somedir/somephoto.png
The above will add the comment "test" to the file, which you can display with:
Code:
identify -verbose /somedir/somephoto.png | grep "Comment:"
For example to add a comment to all .png files in the current directory:
Code:
for file in *.png ; do mogrify -comment "test" "$file" ; done
For more information on what you can change: