Home / Articles / Adobe Photoshop Lightroom / Saving and Reading Metadata in Adobe Photoshop Lightroom 2

Saving and Reading Metadata in Adobe Photoshop Lightroom 2

  • Article is provided courtesy of Adobe Press.
  • Date: Feb 18, 2009.


  1. Saving and reading metadata

Article Description

Lightroom is built around the principle that the imported images are the master negatives: Lightroom records the changes made as metadata information and these edit changes are initially stored at a central location in the Lightroom catalog. In this excerpt, Martin Evening talks about saving, reading and tracking metadata in Lightroom 2.

Saving and reading metadata

Another pain point for newcomers to Lightroom has been the question of the best way to save images. In our very first computer lesson we all learned how important it is to always save your work before you close down a program. Some Lightroom users have been confused by the fact that there is no “save” menu item and left wondering if they would lose all their work after they quit Lightroom. Of course you realize soon after using the program that all work is saved automatically. Even if Lightroom suffers a crash or there is a power failure, you should never lose any of your data.

It is important to remember that as you carry out any kind of work in Lightroom—whether you are adjusting the Develop settings, applying a color label or star rating, or editing keywords or other metadata—these edits are initially all stored in a central Lightroom catalog on your hard disk. For simplicity’s sake we can summarize these by grouping them under the term “metadata edits.” Whenever you alter a photo in Lightroom, you are not recording anything in the actual image file. Lightroom is built around the principle that the imported images are the master negatives: Lightroom records the changes made as metadata information and these edit changes are initially stored at a central location in the Lightroom catalog. This is why Lightroom is so much faster at searching images compared to a browser program like Bridge. You can add, search, and read metadata information much more quickly, because the metadata information is stored in an easy-to-access database. However, it is possible to have the metadata information stored in both the database and the individual picture files. In the case of JPEG, TIFF, PSD, or DNG images, there is a dedicated XMP space within the file’s header that can be used to store the metadata. While with proprietary raw files, it has to be stored separately in what is known as an XMP sidecar file.

If you work on an image in the Lightroom catalog using another program such as Photoshop or Bridge and you make any changes to the metadata, these edit changes will always be made to the file itself. When such an image is opened up via Lightroom again we can find ourselves having to decide whether the “truth is in the database” (the Lightroom catalog database) or the “truth is in the file.”

Saving metadata to the file

For all the time that you are working in Lightroom it should not really matter if the metadata information is stored only in the central database. Of course it feels kind of risky to trust everything to a single database file, but that is why there is a built-in database backup feature in Lightroom as well as a diagnostics and a self-repair function (see Figure 4.67) to help keep your database file protected. Plus I highly recommend that you back up your data regularly anyway. Despite all that, it is still important to save the metadata edits to the files so that the “truth is in both the database and the file.” By doing this you can maintain better compatibility between the work you do in Lightroom and the work you do using external programs.

So what is the best way to save metadata to the files? If you go to the File menu and choose Catalog Settings, you will see the dialog shown in Figure 4.68, where there is an option called “Automatically write changes into XMP.” In the previous version of this book I recommended you keep this option switched off because it could slow down the Lightroom program. However, since the version 1.3 update, it has been OK to leave this switched on because Lightroom will now only automatically write to the files’ XMP space when it is convenient to do so, without affecting the program’s performance. Checking this option will ensure that all the files in the Lightroom catalog will eventually get updated. However, if you want to be sure that a file’s XMP space gets updated right away or you have “Automatically write changes into XMP” switched off, then you can use the Metadata 124icon02.jpg Save Metadata to Files command (or Photo 124icon02.jpg Save Metadata to Files, if working in the Develop module). This forces an immediate export of the metadata information from the Lightroom internal catalog to the image file’s XMP space. In practice I’d recommended using the 131icon01.jpg181icon01.jpg(Mac), 131icon03.jpg181icon01.jpg(PC) shortcut anyway every time you wish to export and update the metadata to a photo or a group of selected photos.

Tracking metadata changes

In order to keep track of which files have been updated and which have not, Lightroom does offer some visual clues. If you go to the View menu and open the View Options dialog, there is a check box in the Cell Icons section called Unsaved Metadata. When this is checked you may see a “calculating metadata” icon (177icon01.jpg) in the top-right corner of the grid cells as Lightroom scans the photos in the catalog, checking to see if the metadata is in need of an update. You will also see this when Lightroom is in the process of saving or reading metadata from a file. If the metadata in the catalog and the file are in sync, the icon will disappear. If there is a “metadata status conflict” you will see either a down arrow (Figure 4.69) or an up arrow (Figure 4.70). The down arrow indicates that the metadata information embedded in the photo’s XMP space is now out of date compared to the current Lightroom catalog file and that now would be a good time to choose Metadata 124icon02.jpg Save Metadata to File (131icon01.jpg181icon01.jpg[Mac], 131icon03.jpg181icon01.jpg [PC]). Figure 4.71 shows the Library View Options dialog with the Unsaved Metadata option circled.

In the Metadata panel (Figure 4.72) is an item called Metadata Status, which will say “Has been changed” if anything has been done to edit the photo metadata settings since the last time the metadata was saved to the file. This is basically telling you the same thing as the metadata status icon that appears in the Library grid cells.

Choosing Save Metadata to File will make the metadata status icon in the Library grid cells disappear, but if you are uncertain what to do you can click the icon in the grid to open the dialog shown in Figure 4.73. This dialog asks if you want to save the changes to disk (better described as “do you wish to confirm saving the metadata changes to the photo’s XMP space?”).

The up arrow shown in Figure 4.70 indicates that the metadata information embedded in the image file’s XMP space is out of sync and more recent than the current Lightroom catalog file. This will most likely occur when you have edited a Lightroom catalog file in Camera Raw and the externally edited image has a more recently modified XMP than the Lightroom catalog. To resolve this choose Metadata 124icon02.jpg Read Metadata from file.

The other possibility is that a Lightroom catalog photo may have been modified in Lightroom (without saving the metadata to the file) and also been edited by an external program, resulting in two possible “truths” for the file. Is the truth now in the Lightroom catalog, or is the truth in the externally edited file XMP metadata? If you see the icon shown in Figure 4.74, click to open the dialog in Figure 4.75 where you can either choose Import Settings from Disk if you think the external settings are right, or choose Overwrite Settings if you think the Lightroom catalog settings are the most up to date.

XMP read/write options

Let’s now take a closer look at what this XMP settings business is all about. The XMP space is the hidden space in a document such as a JPEG, TIFF, PSD, or DNG file that is used to write the metadata settings to. In the case of proprietary raw files it would be unsafe for Lightroom to write to the internal file header, so .xmp sidecar files are used instead to store the XMP metadata. The XMP metadata includes everything that is applied in Lightroom, such as the IPTC information, keywords, file ratings, flags, and color labels, as well as the Develop settings that are applied via Quick Develop or the Develop module.

In the Metadata section of the Catalog Settings (Figure 4.68), the “Include Develop settings in metadata inside JPEG, TIFF and PSD files” option lets Lightroom distinguish between writing the Develop settings metadata to the XMP space for all files including JPEGs, TIFFs, and PSDs, or to raw and DNG files only. This is a preference that predetermines what gets written to the XMP space when you make an explicit command to save the file metadata out to a file. The ability to save Develop settings with the file can be a mixed blessing. If you are sharing images that are exported from Lightroom as individual images (or as an exported catalog) with another Lightroom user, you will most definitely want to share the Develop settings for all the images that are in the catalog. But if you are sharing files from Lightroom with Bridge CS3 or later, this can lead to some unexpected file behavior when you open non-raw files via Bridge. Basically what will happen is that raw and DNG images that have had their Develop settings modified via Lightroom will open via Camera Raw in Bridge exactly as you expect to see them, since Bridge is able to read the settings that were created in Lightroom. However, where you have non-raw files such as JPEGs, TIFFs, or PSDs that have been edited using the Develop settings in Lightroom, and the Develop settings have been written to the file’s XMP space, Bridge may now consider such files to be like raw files and open them up via Camera Raw rather than open them directly in Photoshop. That’s what I mean by mixed blessings. If you want Lightroom to retain the ability to modify the XMP space of non-raw files for data such as file ratings, keywords, and labels but exclude storing the Develop settings, you should uncheck the “Include Develop settings in metadata inside JPEG, TIFF and PSD files” option. Do this and the Lightroom Develop settings for non-raw files will only get written to the catalog and they won’t get exported to the files when you choose Save Metadata. But raw and DNG files will be handled as expected. On the plus side, you will never be faced with the confusion of seeing your non-raw images such as JPEGs unexpectedly default to open via Camera Raw when you try to open them up in Photoshop CS3 or later. The downside is that if you modify a non-raw image in Lightroom using Develop, these changes will only be seen in Lightroom and not by Bridge. For these reasons, my advice is to turn off “Include Develop settings in metadata inside JPEG, TIFF and PSD files.” To help explain the settings and how they affect image files after being modified in Lightroom, I have summarized how these options affect the way different file formats will be handled. Please note that these steps do assume that you are using Photoshop CS3 with Bridge CS3 (or later) and have updated Camera Raw to version 4.1 or later.

  1. If a photo in Lightroom is modified using the settings shown here with “Automatically write changes into XMP” and “Include Develop settings in metadata inside JPEG, TIFF and PSD files” switched on, then all the adjustments that are made to the image will automatically be saved to the Lightroom catalog and also saved to the original image file. In the case of proprietary raw files, the XMP metadata will be written to an XMP sidecar file and when opened via Bridge, will (as you would expect) open via the Camera Raw dialog with the same Develop settings that were applied in Lightroom. In the case of DNG files, the XMP metadata will be written internally to the file and these too will open in Camera Raw. In the case of JPEG, TIFF, and PSD files, because you are including the Lightroom Develop settings in the export to the XMP space, they will default to opening in Bridge via the Adobe Camera Raw dialog.
  2. If the “Automatically write changes into XMP” option is disabled, the metadata edits will now only be saved to the Lightroom catalog. If you were to open a JPEG, TIFF, or PSD image from Bridge that had been edited in Lightroom, it will open directly in Photoshop and not open via the Camera Raw dialog. But at the same time, any image ratings, metadata keywords, or other information that have been entered while working in Lightroom will not be visible to Bridge or any other external editing program (this assumes that you are not manually saving the metadata to the file, as described in the following paragraph).

    In this example, the “Include Develop settings in metadata inside JPEG, TIFF and PSD files” option is still switched on, so if you did want the metadata edits to be saved to the files’ XMP metadata space, you would have to do so manually using a Save Metadata command (131icon01.jpg181icon01.jpg[Mac], 131icon03.jpg181icon01.jpg [PC]). But in doing so, the problem with a Save Metadata command is that you would again be saving all the Lightroom settings to the files’ metadata space (including the Develop settings) and we are back to the same scenario as in Step 1 where non-raw files may default to opening via Camera Raw, which is perhaps not what the customer wanted!

  3. Now let’s look at what happens when “Include Develop settings in metadata inside JPEG, TIFF and PSD files” is disabled and “Automatically write changes into XMP” is switched on. Any edits made in Lightroom will automatically get saved to the Lightroom catalog as well as to the files’ XMP metadata space—all the settings, that is, except for the Develop settings, which will be saved to the proprietary raw and DNG files, but not to the JPEG, TIFF, or PSD files.

    In this scenario, all metadata information will be saved to all types of files (with the exception of the Develop settings not being written to JPEG, TIFF, or PSD files that have been edited in Lightroom). Proprietary raw and DNG files that have been edited in Lightroom will preserve their appearance when viewed in Bridge, and will open as expected via the Bridge Camera Raw dialog. But with JPEG, TIFF, or PSD files the Develop settings won’t be transferred and because of this they will open from Bridge directly into Photoshop without opening via the Camera Raw dialog. The downside is that such images may not always look the same in other programs as they did in Lightroom. It all depends on whether you want to use the Develop module to modify the JPEG, TIFF, or PSD images as you would do with the raw images. Overall this is probably the most useful configuration to use, because it preserves the informational metadata in non-raw files that have been modified in Lightroom and avoids non-raw files opening up via the Camera Raw dialog.