I recently gave ~200 photos numerical titles in Shotwell which describe their sequences--001, 002, etc. But I'd like for this sequence to be the same in the filenames, too, so that when I open the folder in Nautilus the photos are listed in order. I think Shotwell saved the title in the exif data somewhere. In fact, I finally found it using the Gnome image viewer, under XMP Other and photoshop:Headline. What I'd like is a way to read these Shotwell titles and have those used as the filenames. I could probably do this with Python if I knew how to access that metadata.


I did a apt-cache search exif, and found (among other packages):

exiv2 - EXIF/IPTC metadata manipulation tool  
bins - Generate static HTML photo albums using XML and EXIF tags  
exif - command-line utility to show EXIF information in JPEG files  
exifprobe - Read metadata from digital pictures  
exiftags - utility to read Exif tags from a digital camera JPEG file  
jigl - Generates a static html photo gallery from one or more directories of images  
libexif-ruby1.9.1 - EXIF tag parsing Library for ruby1.9.1  
libimage-exif-perl - Perl module to extract EXIF information from image files  
libimage-exiftool-perl - Library and program to read and write meta information in multimedia files  
libimage-info-perl - allows extraction of meta information from image files  
metacam - extract EXIF information from digital camera files  
pyrenamer - mass file renamer written in PyGTK  
python-exif - Python library to extract EXIF data from tiff and jpeg files  
renrot - Rename and rotate files according to EXIF tags  

So try pyrenamer. If you can't make it do what you like, you might build your own tool with python-exif

  • Thanks a lot. I totally didn't know about 'apt-cache search'. I ended up writing something with python-exiv2, and it works! – Jonathan Dec 3 '11 at 23:15

As there is no other answer showing how to actually rename photos with the titles added in Shotwell, here is a quick way to script it using bash, as you say in the comments that you already have a python alternative. There may well be other ways of doing it, but this one might be useful for someone.

As you have already given your pictures a title in Shotwell and exported them, and found out where the metadata is stored that Shotwell adds, it is relatively straightforward to put a script together.

Please install libimage-exiftool-perl, as that will be necessary for the script.

1) If you use exiftool -a G1 -s pic.jpg, you can see all the metadata types and tags embedded within a picture, and also where Shotwell places the metadata:

[XMP-photoshop] Headline                        : 002
[XMP-dc]        Title                           : 002
[IPTC]          Caption-Abstract                : 002
[IPTC]          Headline                        : 002
[IPTC]          OriginatingProgram              : Shotwell
[IPTC]          ProgramVersion                  : 0.13.1+trunk

2) Now either the XMP-photoshop or the IPTC tags can be used with exiftool in our script to show the metadata (and then use that resulting value to rename the file).

Entering exiftool -IPTC:headline pic.jpg results in

Headline                        : 002

and this can be parsed with awk and fed back as the variable to rename the file:

mv -i "$i" "$(exiftool -IPTC:headline "$i" | awk -F ': ' '{print $2}').jpg"

3) The final script would be like this:


for i in *.jpg
    mv -i "$i" "$(exiftool -IPTC:headline "$i" | awk -F ': ' '{print $2}').jpg" 

So, now all your files have been renamed with their Shotwell titles, as we see when we examine one with exiftool -a -G1 -s pic.jpg:

ExifTool Version Number         : 9.12
File Name                       : 002.jpg


  • The repository version of exiftool is fine, but is quite old, so if you need support for various new features and bugfixes, see the official site for how to build and install the more recent version.

  • All of the metadata is preserved unchanged by the script, as only the actual file itself is being renamed.

  • The script will obviously only work if your pictures have titles created with Shotwell embedded within them, but it could be adapted for other purposes.

  • There may also be an alternative way to do this with exiftool, without invoking awk, so I will investigate further.

For more general information, see man exiftool or the Ubuntu manpages online.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.