aaron-kelley.net

My little corner of the Internet

Migrating Vista’s Windows Photo Gallery database

I’ve taken a liking to the Windows Photo Gallery application that comes with Windows Vista. It’s nice for organizing photos and videos, and the killer feature for me is the hierarchical tagging, a feature that I cannot find in any other free photo management app for Windows.

Windows Photo Gallery stores tag information directly in the files you are tagging, when possible. For instance, when tagging JPEG files, the tags are stored in the JPEGs using XMP. Also, if you modify other information about the files (such as the date/time a photo was taken), that information is stored in the file if possible.

In some cases, the information cannot be stored in the file itself; for instance, if the file is marked “read only,” or if the file format does not support metadata (PNG, AVI, etc.). In this case, Windows Photo Gallery still allows you to do anything you could to a file that it could store the information in, only, it stores the information in its own little private database. This is transparent to the user.

If you want to move your “gallery” to a different machine, and your gallery consists only of JPEG images, you can probably just copy them all to the new machine, and Windows Photo Gallery will automatically index them and rebuild its list of tags. However, if you have other types of files in your gallery, the information will not be carried along with these files and you’ll have to re-tag them. Ugh.

I’ve been looking into migrating the Windows Photo Gallery database. There doesn’t seem to be any supported way to do this (someone please correct me if I’m wrong).

The database itself is easy to find — it is the Pictures.pd4 file, found in AppData\Local\Microsoft\Windows Photo Gallery in your Windows profile folder. So, to migrate the database, it should be as simple as moving this file to the new machine, and making sure that the paths to all of the files in your gallery remain the same, right?

Well, after trying this and running Windows Photo Gallery, we come up with a curious dialog box.

20080313_a_wpg-notfound

Note that the folder it is complaining about is actually present on the machine.

Here, you have some options. If you click on “Find the folder,” and browse for it, you might end up with a duplicate of every file appearing in your gallery (and the folder is listed under “Folders” on the left twice, with no way to remove either of them). If you click on “Remove the folder,” all of the files in your gallery disappear, and your tag information is lost (even if you manually add the folder back). And if you click on “Cancel,” everything works great, all of the files appear and all of the tag information appears to have been migrated succesfully… Except, this dialog reappears every time you run Windows Photo Gallery.

In trying to figure out a way to either migrate the information without causing this dialog to appear, or to figure out why Windows Photo Gallery doesn’t seem to like the Pictures folder even though it has the same path as before, I set up two identical galleries on two separate machines and compared their Pictures.pd4 files. Skipping a lot of the details, I did eventually stumble on the key difference.

20080313_b_driveserial

Windows Photo Gallery is checking your volume information (volume label and serial number) and storing it in its database; it is then using this to verify that the files are on the same drive that they were before. If you move the database to a different machine, the volume serial number is not the same, so it throws up the error we saw above. You can’t just edit the volume serial number in the Pictures.pd4 file to match the new one, though, Windows Photo Gallery is able to detect that the file has been tampered with (you’d have to go fix some other checksum stuff to get that to work). The easiest thing to do is just to change the volume serial number on your “destination” machine to match the one of the “source” machine. You can do that with this SysInternals utility, VolumeID.

So, migrating your Windows Photo Gallery database, step-by-step:

  • Copy all of the files in your gallery to the new machine. Make sure the path to them remains the same as it was on the old machine.
  • Copy the Pictures.pd4 file to the new machine.
  • Change the volume ID of the C: drive (and any other drives with folders indexed by Windows Photo Gallery) on the new machine to be the same as on the old machine, using VolumeID. (Reboot for the changes to be visible, before running Windows Photo Gallery.)

Note that Windows Live Photo Gallery can be migrated similarly.

Tags: , , , , ,

Comments are closed.