#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    Adding Comments to JPEG files via Python


    Hi all! I need some help regarding JPEG files and their descriptions.

    Here's the deal, I have about 4-5 thousand JPEG images that I need to add descriptions to. I also have a .txt file and an Excel file that has a list of all the picture files with their filenames, and the description is written for each one. I need those descriptions on the picture files themselves, within their metadata.

    Rather than manually adding comments to thousands of pictures, describing what's on each picture, I was wondering if it was possible to make a Python function do all the work. I need Python to edit the metadata of each of the pictures and add the appropriate comment/description (written both in the .txt file and the Excel table) to each one of them.

    I presume it's possible, I just need some advice and a good starting point from the more skilled people around here. Please help, thank you!
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,837
    Rep Power
    480
    I'd use a shell script with imagemagick convert

    $ convert picture0.jpg -comment "pretty as a" t.jpg
    $ mv t.jpg picture0.jpg
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo