About The iPhoto Library Folder
iPhoto stores all of the photos and information about your library in an iPhoto library folder. When you import photos into iPhoto, they are copied by iPhoto into the library folder, and iPhoto takes care of organizing them within that folder and keeping track of where they are. iPhoto also creates a handful of its own data files in the library folder along with the photos themselves. These files contain information such as how you have your photos organized into albums, the title, ratings, keywords, and other information you assign to your photos, and much more. Note that in iPhoto 7, Apple has now changed the library folder so that it is a package, meaning that it no longer appears as a folder in the Finder. You can still delve into its contents, however, by control-clicking on it and selecting "Show Package Contents" from the contextual menu.
Typically, while working with iPhoto, it keeps all the details of this folder hidden from you. You can just use iPhoto's interface to manage your photos, and you never even need to look inside the iPhoto library folder itself. However, in some cases, especially if you encounter problems with your iPhoto library, in can be useful to know a little bit more about what goes on inside the library folder. Following is a brief description of some of the stuff you'll find inside the library folder. Note that there are some small and some large differences in the folder structure depending on what version of iPhoto you're using.
Library.data (iPhoto 2), Library.iPhoto (iPhoto 4 & 5), Library.iPhoto6 (iPhoto 6 and later), iPhoto.db (iPhoto 2, 4, & 5), Dir.data
These files serve as the central database where iPhoto stores your library information. All your roll, album, and photo metadata is stored in these files.
This file is written out by iPhoto as a way for other applications (such as iMovie and iDVD) to be able to easily access the contents of your iPhoto library. You can read in more detail about this file here.
Thumb32Segment.data, Thumb64Segment.data, ThumbJPGSegment.data
In order to improve performance, when you add photos to your library, iPhoto creates small "thumbnail" versions of your photos and caches them in these files. In iPhoto 5 and earlier, these files are instead called Thumb32.data, Thumb64.data, and ThumbJPG.data.
This file is written out by iPhoto and read in by Spotlight in order to index the information about the photos in your photo library. You must have iPhoto 5.0.2 or later for this file to be present.
This file is used by iPhoto to help prevent more than one copy of iPhoto from accessing the library at one time.
This file is actually not written out by iPhoto itself, but rather by iPhoto Library Manager. It is a copy of the preferences file that is associated with this library. When you switch between different iPhoto libraries, iPhoto Library Manager will swap out this preference file for the existing preferences before opening the library up.
In iPhoto 4 and earlier, iPhoto stores some album data inside this folder and also creates a subfolder for each album in your library. Each subfolder is populated with aliases pointing to the actual photos contained by that album. The Albums folder is not created by iPhoto 5 or later. If you have iPhoto 5 or later and still see an Albums folder, it is probably just leftover after having upgraded from a previous version, and is no longer being updated as you make changes.
iPod Photo Cache
This folder is created by iTunes if you choose to sync your iPhoto library with a photo capable iPod. It contains cached information about the last time the photos were synced and help speed up the syncing process, allowing iTunes to tell which photos have changed since the last sync and only update those ones
2006, 2005, 2004, etc.
When running iPhoto 5 or earlier, these folders are where iPhoto stores the actual photos that are in your library. The photos are organized in a hierarchy of subfolders based on their dates. For example, a photo dated February 24, 2004 would be found by looking in the "2004" folder (year), then the "02" folder (February, month #2), then the "24" folder (the day). Inside each "day" folder are the photos themselves, along with a folder named "Thumbs", which contains scaled down copies of the original photos. There may also be a folder named "Originals". If you edit a photo in iPhoto, it will make a copy of the original photo inside this folder before making any changes. That way, you can later revert to the original version within iPhoto if you want to discard the changes. You may also see files in these folders ending with ".attr" or ".roll". These files are created by iPhoto 2 and earlier only, and are unused by iPhoto 4 and later.
Data, Originals, and Modified
iPhoto 6 organizes its photos fairly differently that previous versions. Imported photos will initially be stored inside the "Originals" folder. Within that folder, photos are organized into subfolders based on the roll that they are in, so each roll gets its own folder. Those rolls are then sorted by date (2006, 2005, etc.) and put into dated folders accordingly. So, if you had a photo in a roll named "Vacation" and dated February 24, 2004, to find that photo, go into the "Originals" folder, then into "2004", then into the folder named "Vacation". When you edit a photo in iPhoto, the original stays where it is, and the edited photo is placed in the "Modified" folder, which has the same per-roll organization scheme within it as the "Originals" folder does. The "Data" folder contains all the scaled down thumbnail version of photos in your library. If you upgrade to iPhoto 6 from a previous version, iPhoto will rearrange all your photos from the old scheme into the new scheme. After upgrading, you may still see one or more leftover folders named "2004" and such. These folders should no longer contain any files being used by iPhoto 6, and can be disposed of safely.
This folder is created only by iPhoto 7. There does not seem to be any mention of this folder in iPhoto's documentation, but if you put some photos into it, then quit and reopen iPhoto, it will automatically import those photos into the iPhoto library and then delete them from the Auto Import folder. There is also an "auto import" Applescript command which does not appear to do anything when called. It's not clear if this was a planned feature for iPhoto 7 that ended up getting pulled out (but not completely, apparently), and it doesn't seem to be very useful for anything, especially since that folder is buried inside a package now, but that's what it does if anyone is curious.
This is part of the new package structure in iPhoto 7 that gives the package a type and creator code so that the Finder knows what application the package belongs to.
The AlbumData.xml file