<jupyter_start><jupyter_text>Get images metadataGets all .jpg images in the current folder and prints the "description" metadata, using the Python Imaging Library (PIL).<jupyter_code>import glob
import PIL
from PIL import Image
from PIL import IptcImagePlugin 
imgpaths = glob.glob('*.jpg') # change it to jpeg or anything
imgpaths
for imgpath in imgpaths:
    img = Image.open(imgpath)
    imgInfo = IptcImagePlugin.getiptcinfo(img)
    description = imgInfo[(2, 120)]
    author = imgInfo[(2, 80)]
    print(imgpath, '>')
    print('Author:', author.decode('utf-8'))
    print(description.decode('utf-8'), "\n") # str.decode('utf-8'): for compatibility with windows<jupyter_output>150206_Costa_Carolina_chaise_01.jpg >
Author: <NAME>
Genève, le 6 février 2015. Devant la cathédrale Saint-Pierre. Rencontre avec <NAME>, comédienne (assise sur la chaise de chaire de la cathédrale).Photo: Laurent Guiraud. 

160523_Elg_Aline_01.jpg >
Author: <NAME>
Genève, le 23 mai 2016. Rencontre avec <NAME>, historienne. Photo: Laurent Guiraud.
{'fraction_non_alphanumeric': 0.10949612403100775, 'fraction_numerical': 0.035852713178294575, 'mean_word_length': 5.076470588235294, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '307925', 'license': 'MIT', 'n_tokens_mistral': 376, 'n_tokens_neox': 346, 'n_words': 106, 'path': 'Get_images_metadata.ipynb', 'repo_name': 'palrogg/utilities', 'size': '1061'}