Adding a comment to an image using PIL

J

Jeffrey Barish

I am trying to use PIL to add a comment to an image. I have never used PIL
before, but I discovered that it is possible to print an existing comment
with the following:

im = PIL.Image.open('filename.jpg')
print im.app['COM']

I figured that I could write a comment by reversing this procedure:

im.app['COM'] = 'New comment'
im.save('newfilename.jpg')

However, when I open newfilename.jpg, I find that key 'COM' does not
exist -- the comment is not being written. Presumably, I am doing
something wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top