On Sun, 25 May 2003 14:28:25 +0100, Bill Bedford wrote:

>Can anyone suggest a way of automating the writing of comments fields
>in jpegs?

If at all possible, you should avoid rewriting the image of the JPEG
file with a graphics program. You'll loose image quality.

If at all possible, you should try to parse the JPEG file into (enough)
blocks), and insert a comment block at a break point. That sounds like a
job for Perl, for example. Ah, look, there exists a module to do the
nitty gritty for you: JPEG::Comment:

        <http://search.cpan.org/author/IFROL/JPEG-Comment-02/>

If you're not planning on using Perl but rather write your own, you
could use it as an example. There's only one function there, of 26
lines.

   HTH,
   Bart.