Rajje

Q: View file names under images?

In iPhoto, the titles of all imported images were set to the file names and it was therefore possible to have the file names displayed under every image.

 

In Photos, titles can be viewed by selecting View > Metadata > Titles, but all titles are empty on newly imported images. There seems to be an option to view the file name as a separate field, by selecting View > Metadata > Referenced file. However, this option does nothing. But when I search for a file name, the correct images show up, so Photos obviously keeps track of the file names somehow.

 

So, how can I view the file names under every image, or import the file names into the titles?

Posted on Apr 8, 2015 4:35 PM

Close

Q: View file names under images?

  • All replies
  • Helpful answers

  • by Clem,Helpful

    Clem Clem Apr 9, 2015 3:10 AM in response to Rajje
    Level 3 (677 points)
    Apr 9, 2015 3:10 AM in response to Rajje

    Choosing to View > Metadata > Referenced File doesn't do that. It will show or hide a badge on the image IF the file is a referenced file, meaning when it was imported it was not copied into the library bundle but was left in its location in the file system. These referenced files cannot be synced with iCloud Photo Library.

     

    You can see the image's file name in the Info panel. You cannot display it in the grid.  It might be possible to use AppleScript to take the file name and make it the title, couldn't say....

  • by Rajje,

    Rajje Rajje Apr 9, 2015 2:04 AM in response to Clem
    Level 1 (10 points)
    Apr 9, 2015 2:04 AM in response to Clem

    OK, thanks.

     

    I dug around a little and this definitely seems to be a bug in how the iPhoto library is converted to a Photos library. iPhoto didn't just display file names under the images. Rather, on import, iPhoto actually sets the image titles to the file names minus the file extensions (e.g. ".jpg"). But those titles, as well as the titles manually set in iPhoto, are not imported properly into the Photos library.

     

    I located the Photos library database. It's in the library package > Database > apdb > Library.apdb. The file is in SQLite format and can be browsed and edited with e.g. "sqlitebrowser" (http://sqlitebrowser.org/).* In it, I found that there is a table called RKMaster, that holds information about all original images. RKMaster has an attribute called "name" that contains all the original image titles. This is not the same as the file name, which is a separate "fileName" attribute in the same table, which in my case contains the same information as the "name" attribute, but with file extensions.

     

    Then there is another table, RKVersion. This table contains information about the different versions of all images and this information is the one actually being displayed when you use the application. RKVersion has attributes for "name" and "fileName" as well. In my Photos library, "name" is empty for all my newly imported images, but "fileName" has all the correct file names with file extensions. If I edit the database and insert something in the "name" attribute for an image, the name is then displayed as an image title in Photos.

     

    I then opened the library file from my old iPhoto library and it has a similar structure. In its RKVersion table, all the "name" attributes are filled out and they contain all the image titles I want to see. So I can conclude that during the conversion from iPhoto to Photos, the "name" attributes were simply not copied over, and that is why all my images now lack titles.

    I will try to find a way to copy this whole column from the iPhoto library into the Photos library, which should solve the problem.

     

    * Please be aware that editing this file may cause irreversible damage to the library. Make sure there is a backup of the whole library before digging into these files.

  • by Rajje,Solvedanswer

    Rajje Rajje May 19, 2015 2:47 PM in response to Rajje
    Level 1 (10 points)
    May 19, 2015 2:47 PM in response to Rajje

    According to an Apple support article, https://support.apple.com/en-us/HT204478 , only user-defined titles are migrated. That information seems to be correct, since the very few titles that were migrated for me, were ones I had set in iPhoto instead of by naming the files. I tried to find any sort of "user-defined title" attribute in the iPhoto database, but without any luck.

     

    I solved my problem by writing a Python script that goes through the databases of the old and new libraries and tries to find matching UUIDs. Where it does, it copies over the image title from the old to the new. Unfortunately, many UUIDs are changed in the migration, so for me it only found matches for 37 % of the images. Therefore, I added a function to the script that sets all remaining titles in the new library based on file names. All file extensions are excluded and titles are only created if current titles are empty. The script also lets you run only one of the two functions if you want.

     

    The script makes a backup of both databases before running. I have tested it but not thoroughly, so if anyone wants else to use it, proceed with caution.

     

    https://github.com/Rajje/PhotosTitleSetter