Listing the used fonts of an image in GIMP

GIMP uses the .xcf format to store images and layers. While it also stores the meta data of each layer and the fonts used for text layers it is not easy to get a list of all fonts.

Under Filter > Python-Fu > Console it is possible to access a Python console which can be used to programatically access every image currently loaded. The following listing prints out a list of Fonts used any image that is currently open.

for image in gimp.image_list():  
    for layer in image.layers:
        try:
            layer.parasite_find('gimp-text-layer').data
        except AttributeError:
            pass

Just copy and paste the above snippet into the Python console and hit enter twice. The script will loop through each image, access all layers and print the data of those layers that are text layers.