BragIt
Lightroom

How to Recover Images from Lightroom Previews

This describes how you can recover images from the preview file of Adobe Photoshop Lightroom 2.x . It may be useful if you have happened to delete the original images while 1:1 rendered previews still exist. A manual procedure is described that should work on both Mac OS and Windows, although it is only tested on Mac OS with preview files from Adobe Photoshop Lightroom 2.3.

[Harald E Brandt, Stockholm, July 2009]

Update in November 2013:

I received a nice thank-you-mail in october informing me that the procedure still works fine in Lightroom 5.0! And since one person lately had difficulties to understand, I just added a few small clarifications in the manual procedure.

Update in April 2014:

Adobe has published its own script that should extract previews. You may try that out at: http://helpx.adobe.com/lightroom/kb/extract-previews-lightroom-4.html.

Summary

If the original image is lost, Adobe Photoshop Lightroom may still have a preview of the image. Previews come in different sizes, and if there is a 1:1 preview of the image, you can recover that image as a jpg and use it henceforth as the "original" — you will get the same resolution as the original image, and almost the same quality. Also, all metadata, such as EXIF-data and keywording, is preserved. The manual procedure does not require any special software, although I do use Photoshop in one step.

Can images be lost despite a good backup strategy?

Even if you have a good backup strategy, there are many ways in which a file can be accidentally deleted with no backup — life is not perfect, and backup strategies are not perfect. In my case, I use Time Machine — the golden Mac OS X backup solution, which works very well, and can absolutely not be blamed for this incident. The following describes how it happened to me in Lightroom 2. [In Lightroom 4 it works differently]:

After import of images, I flag images I do not want to keep with Reject. I have the filter set to show only images that are not flagged Reject (so all rejects become hidden automatically when I flag them). When I am ready, I move all rejects to a special folder with to-be-deleted images, which I later empty (usually much later, such as weeks or months). This way, I keep thumbnails of all images, including rejects. This special folder that only contains rejects is exempted from backup. This scheme works very well and is very robust.

However, there is a pitfall: If images are stacked, and I reject the first image in a stack, and I then move the rejects to the special temporary to-be-deleted folder, then all images in the stack will be moved there! I.e also the non-rejects! Very dangerous! Although I knew the issue, this time I forgot it, and I was away from home, so it took several days until I did the backup (in Time Machine), and at that time all images were sorted and flagged as they should (exept the issue that some non-rejects were in the to-be-deleted folder). Since the backup is set not to backup the folder with to-be-deleted images, I did of course not have a backup of those images. Later, I did the real delete of the to-be-deleted images, which completed the loss of the originals.

And it was only after this I found out I had lost a few images. But fortunately, I had 1:1 previews of them, and it was still in the preview file. I was again away from home, so no internet connection, no way to download special software, so I developed the following manual procedure:

The manual procedure

To Extract jpg from previews:

  1. Select the missing photos in LR and export as catalog with previews (File > Export as Catalog... and tick 'Include available previews').
  2. Open the exported preview package (.lrdata) to see all its internal files ('Show Package Contents', but in Windows I guess it is a regular directory and not a "package" as in Mac OS).
  3. Open each file (.lrprev) in a pure-text or hex editor (such as HexEdit, Smultron, pico in Terminal, or Notepad++ in Windows). Note the name of the color profile listed early in the file (colorProfile = ...). Search for the last occurrence of 'AgHg', after which there should be a few characters followed by 'level_7' if you had a 1:1 preview. Delete everything before AgHg and save the file with file extension jpg.

    Make sure you do not mess with encodings, and for that reason the safest is to use a "raw" editor such as HexEdit or pico (but it actually works even with TextEdit if you are careful). Many image viewers, such as Preview in Mac OS X, will claim that such saved jpg-files are corrupt, and even Lightroom does that. But Photoshop can open them, and we will do that in the next step:

  4. For each such saved jpg image, open it in Photoshop, assign the same profile you noted above (should be 'ProPhoto RGB' if the preview quality was set to High in the original catalog, but 'Adobe RGB' if the preview quality was set to Medium). 'Save As', with the exact name and location it should have in LR, but keeping the jpg extension, 'Embed Color Profile', and choose Maximum quality. Keep the Photoshop image open for later comparison.
  5. Open the original catalog, and click the missing-file icon in the upper right corner of the thumb nail. Locate the image. If it was a raw file (such as dng), LR will ask if you really mean this, since it has a different file extension. Confirm, and surprisingly it accepts that the found image is a jpg despite it was a dng. However, since the develop settings are set as if it was a raw file (or unmodified jpg), while the new file has already been "treated" with the develop settings you had before, you need to reset the develop settings to zero since it is now a treated jpg (in ProPhoto if the preview quality was set to High). Verify that the image you see in Photoshop and the one in LR look the same, otherwise change the develop settings accordingly.

With the above method, all metadata, such as EXIF-data and keywording, are preserved.

The simple way: LRViewer

There is a really nifty and free software that can browse Lightroom previews directly, and which can export preview images as jpg! See http://ImageIngester.com/LRViewer-info.php for more info. When I came home again to a real internet connection (i.e after I did my manual procedure) I tried this software, and it looks really good.

But at least on one occassion I had to browse the images using the largest thumbnails in order to access the 1:1 previews, otherwise it only exported medium sized previews (about 1600 px wide), but maybe that was just a temporary bug(?) Also, I note that the image it displays and exports is darker than what Lightroom shows in its preview, and what my manual procedure achieves. Looks like LRViewer uses a somewhat different gamma, since shadows are more affected(?) My manually extracted ProPhoto image looks exactly the same as the Lightroom preview, whereas the LRViewer version has slightly darker shadows and mid tones. You may need to experiment a bit if you use LRViewer extensively, and it might differ with different catalogs or settings?

Harald E Brandt
Hägersten, Stockholm
Sweden
Photo: http://photo.bragit.com
BragIt: http://bragit.com
Email:
Last updated: 2014-04-08 at 17:48:30 +0200