The ultimate size of the Library.iPhoto file is camera specific. Only some photos greatly enlarge Library.iPhoto. Only some cameras cause iPhoto5 slowness.
Slow opening and closing (multiple minutes) of iPhoto 5 when you have 1000s of photos appears to me directly related to the size of the file Library.iPhoto in your iPhoto Library. iPhoto needs this file in memory when unloading, leading to unload times of many minutes (despite a Macintosh normally being able to handle a file of this size in seconds). These slow opening and closing problems show up clearly when the Library.iPhoto size is hundreds of megabytes. If the Library.iPhoto size is small, iPhoto 5 can handle up to 25,000 photos.
The size of the Library.iPhoto file is camera specific. Only photos from certain cameras create problems in iPhoto 5. Some (or all) Casio, Konica Minolta, Kyocera, Pentax and Nikon cameras are likely to be a problem.
In photo images the EXIF metadata known as the MakerNote can be of variable size. It is typically less than 1K bytes. However it is over 30K in some or all Casio, Konica Minolta, Kyocera, Pentax and Nikon cameras.
iPhoto 5 appears to store the MakerNote EXIF metadata in Library.iPhoto. The addition of about 40K per photo over 6000 or so photos explains the Library.iPhoto sizes exceeding 250MB that I observed.
Removing the MakerNote exif metadata from photographs in jpg format before importing them into iPhoto 5 avoids producing large Library.iPhoto sizes. Photos which caused me intolerable delays previously do not produce any delay if the Maker Note is removed prior to import into iPhoto 5. However, I should note that other users have reported that iPhoto 5 has problems other than just the Maker Note one that I list here. I can not comment on other potential problems.
Removing Maker Note from photos from the command line
Please use these programs only on a copy of your photographs. You are making major changes to your photographs.
Anders Hultman in Sweden needed to remove MakerNote material from web photographs. His perl script rmmn-100.pl from http://anders.hultman.nu/data/makernote/ will remove only the MakerNote section of an Exif image file, and optionally leave the date unchanged and other exif metadata unchanged. Only a trivial change is needed to run this on a Macintosh. iPhoto 5 imports photos changed this way without problem. Camera dates and exposure are retained. Unfortunately by importing the photos into iPhoto 5 again you lose album, title, rating, keyword and comments that you added in iPhoto.
After being contacted by an iPhoto user, Anders kindly reworked rmmn-100.pl on 2 September 2005 to remove even more material from photos. The revised version is called exifcleaner, and can be obtained from http://anders.hultman.nu/data/exifcleaner/ Anders also helpfully added material similar to my forum posts on using his new program on a Macintosh.
If you have a camera that autorotates photos, I suggest using the older rmmn-100.pl rather than the new exifcleaner.pl I suspect that autorotated photos react badly with exifcleaner.pl Please note that my camera does not autorotate, so I am unable to confirm my suspicion.
Although it appears possible to use rmmn-100.pl or exifcleaner.pl to alter even photographs already in an iPhoto Library, doing so does not reduce the size of Library.iPhoto even after a Library rebuild.
I can't think of any way to directly fix an iPhoto 5 library, since iPhoto does not appear to rebuild the Library.iPhoto file except when doing the conversion from iPhoto 4 to iPhoto 5.
Details of removing Maker Note
If you want to experiment with batch removals, do so ONLY ON A COPY of your Library or photos.
You will need to modify the rmmn-100.pl program by changing the first line to point to your own copy of Perl (probably /usr/bin/perl ). I found my copy of Perl by typing whereis perl in Terminal. Also, chmod 755 rmmn-100.pl to give it execute permissions. You will need to put rmmn-100.pl in a directory that is in your path, or else give the complete path to it when running it.
If your photos are in a whole bunch of sub-directories (such as a copy of your iPhoto Library directory), you can cd to the starting folder for your photos and then use the find command to modify all of them. You should be careful not to modify your thumbnails, however each camera photo should have a distinctive form. For my Pentax, I used
find . -name 'IMGP*.JPG' -execdir rmmn-100.pl -p '{}' \;
Cut and paste that - the spaces and punctuation are important. Then change the IMGP to suit your camera. Took about 10 minutes on my Mac for 6000 photos, and reports the space saving on each photo.
What that line means and does. The above command (find) starts in the current directory (.), finds all files with names starting with IMGP and ending with .JPG (so it doesn't change thumbnails) from a Pentax Optio 330GS, starting in whichever directory you start it in (say Copy of iPhoto Library). It recurses through each subdirectory until it runs out of them. Within each subdirectory if it finds any file matching -name, then it runs (-execdir) the Perl script rmmn-100.pl (which removes the MakerNote) in the directory it has found. Note that rmmn-100.pl must be set as an executable, and must be in your $PATH (I make a ~/bin directory for little utilities like this).
Again I warn not to do this except with a copy of your library. Especially since it doesn't actually solve the problem by itself.
If that looks complicated, then don't try it. Someone will eventually do an AppleScript or something to make it easier.
I have now made an Applescript droplet that removes MakerNote from photos dropped on it. This simply includes the rmmn-100.pl Perl script, and runs that on each photo. As an alternative, you can start the application and use a file browser to select files for Maker Note removal (note - it is slow to start). I will put the applet here in a day or so (still testing).
Reimporting Photos after removing MakerNote
I tried fixing the photos in iPhoto 4. Although I was able to remove the MakerNote exif from the photos, the iPhoto 5 conversion routines still made a giant Library.iPhoto file. This is generated from information held in the Data directory in every day of the photo library. The *.attr files in my iPhoto 4 library all exceed 40K if taken with a Pentax camera, and are much smaller if taken with a different camera.
If you are transferring thousands of photographs from iPhoto 4 to iPhoto 5, you can simply change all the original photos and then reinput all the photos. This loses any comments you have used previously, leaving you the highly undesirable task of retyping all your comments and keywords.
Only converting your original photos and importing them again will work. This loses all comments and other information, so I haven't done it.
It appears to me very likely that anyone who owns a copy of Brian Webster's iPhoto Library Manager would be able to use the Merge facility in the paid for version to merge Maker Note removed photos from an old iPhoto 4 library into a new iPhoto 4 library. This should retain Title and Comment data. The merged iPhoto 4 library could then be converted into iPhoto 5. Please note that I suspect an iPhoto 5 library with the Maker Note problem would run too slow for this method to be used. However it would probably also work with iPhoto 5 if your library was small (say under 1000 photos). Once again, do all experiments with a copy of your original photos, never with the originals.
Checking Maker Note size
How can I check the size of the MakerNotes with Graphic Converter?
You can see the size of the Maker Note for a photograph by looking in the exif information using Graphic Converter (thanks to MacFormat and Thorsten Lemke of Lemke software for the one year trial package). It is listed as Manufacturer information. Graphic Converter can be used to remove the Maker Note information (it was how I identified what caused the problem), however it appears to me to use a lossy conversion, so it isn't an appropriate program for making such changes.
Graphic Converter refers to that field as Manufacturer Notes. In Graphic Converter, choose Window->Show Information, then click the EXIF Tab. Scroll down to Manufacturer Notes.
If you don't have Graphic Converter. You could import a photo into iPhoto 4 (not 5), and look at the size of the *.attr file that is associated with that photo. If it is over 4kb then your MakerNotes are large.
Script to Remove Maker Note
Sebastien Flory has created a set of applescripts to export the library, strip the exif, reimport the library. While this speeds up iPhoto, it means you lose ALL your photo information, comments, keywords and so on, except for Albums, which it preserves. (5100 photos library.iPhoto file went from 170 Mb to 7 Mb... launch time from 1-2 minutes to 5 seconds).
The scripts are available there: http://www.pluggies.com/seb/iPhotoExportImport.zip (43 Kb)
It will ask iPhoto for all albums and then copy each album's photos in a created folder, stripping -all- infos from the jpg except the date.
Then you re-import those photos and the script will recreate the albums and re-import the photos into each album.
All meta informations from the library will be lost.
It defiantly not optimal, but can make iPhoto usable while waiting for Apple to correct the issue.
Sebastien has included a readme file that explains the procedure using iPhoto Buddy so you keep the old bloated library untouched along with the new optimized one. (Then when Apple fix the issue, you'll be able to go back to your old one with all the meta infos).
iPhoto Exif Cleaner for Mac OS X
Matt Sephton has thoughtfully Platipused up Exif Cleaner as an Apple Application. Matt has added facilities so you simply leave it in the directory your DCIM photo directory is in. This can be on your camera if you desire. It will then clean your photos of Maker Note. Matt has provided two versions. One is the cleaner, with a progress bar. The other provides a report of what would be removed from photos, without actually doing so. Matt has excellent notes on how to install and use the program.
iPhoto 5 file structure
iPhoto 5 file structure on your drive is similar to this:
- year1
- year2
- month
- month
- day
- day
- photo1.jpg
- photo2.jpg
- photo3.jpg etc...
- Thumbs
- thumb1.jpg
- thumb2.jpg
- thumb3.jpg etc...
- day ...
- month ...
- year3 etc...
- AlbumData.xml
- Dir.data
- iPhoto.db
- iPhoto.ipspot
- iPhotoLock.data
- Library.iPhoto
- Thumb32.data
- Thumb64.data
- ThumbJPG.data
When you move from iPhoto 4 to iPhoto 5, you lose the Albums directory, and the Data directories with its two files for each photo. iPhoto 5 adds two files to your library, iPhoto.ipspot (only 50 or so bytes, probably for Spotlight) and iPhotoLock.data, a zero length file perhaps used for locking shared libraries.
Why Does iPhoto 4 Work?
iPhoto 4 handles the same photos from the same camera without problem. iPhoto 4 stores EXIF metadata in a separate .attr file for each photo. These .attr files are in the Data directory included in the directory for each day of photographs. iPhoto 4 does not store the MakerNote information in Library.iPhoto.
Please note that Apple specifically advise against ever directly manipulating the files in your iPhoto Library. If you change files there, you run a strong risk of losing your iPhoto material. Just because I am changing the files does not make it a good idea.
iPhoto 4 file structure on your drive is similar to this:
- year1
- year2
- month
- month
- day
- day
- Data
- data1
- data1.attr
- data2
- data2.attr
- data3
- data3.attr etc...
- photo1.jpg
- photo2.jpg
- photo3.jpg etc...
- Thumbs
- thumb1.jpg
- thumb2.jpg
- thumb3.jpg etc...
- Data
- day ...
- month ...
- year3 etc...
- AlbumData.xml
- Albums
- Pending Rotation
- Photo Library
- Dir.data
- iPhoto.db
- Library.iPhoto
- Thumb32.data
- Thumb64.data
- ThumbJPG.data
The AlbumData.xml file contains information about which album names you have created. It lists the captions used for each photo, and the rating (0 to 5, with 0 being unrated) you gave each photo. It stores the keywords that you used for your library, and which ones each photo uses. As it is an xml file, extracting information from it is possible. This file is updated whenever you make alterations in iPhoto 4.
If you add a comment to your photo, a plaintext version of it is embedded in the .attr file for each photo. This file is not a text file, and adding material to it appears difficult. This file is updated whenever you make alterations in iPhoto 4.
The iPhoto 4 Library.iPhoto file does not appear to contain comments, exif information, nor Maker Notes.
Cameras with large Maker Note
Cameras that create a large MakerNote will eventually cause problems with iPhoto 5. In addition, large non-image material in photos is undesirable in photos used on the web.
Thanks to the many people who sent sample photographs, and enabled me to make this list. The figure in parentheses is a typical MakerNote size for the photo tested.
- Casio EX-23 (29562), Exilim EX-S2 (29562), Exilim S100, Casio P600
- Konica Minolta, DiMAGE Z5, Dynax 7D (Maxxum 7D for US users)
- Kyocera Finecam S3 (55464)
- Nikon D70 (28482), D100 (27560)
- Pentax Optio 330 GS, Optio S (28708), S4i, *ist (55308)
Cameras with small Maker Note
- Canon PowerShot A70 (574), A75 (906), G5 (612), Pro90IS (384), EOS 300D (1408)
- Digitrex (460)
- Fuji FinePix 2600 Zoom (238), FinePix S602Zoom (274)
- Kodak CX6330 (1274), DC240 (564), DX6340 (1300), DX6490 (1300)
- Konica Minolta KD-420z (688)
- Nikon E5000 (954), E5700 (770)
- Olympus Camedia C2040Z (520), C2100UZ (460), C750UZ (840), C860L (264)
- Panasonic (probably OK)
- Sony Cybershot, DSC-P10, DSC-V1 (1504), DSC-P43 (1578), DSC-U30 (1562)
To Do
Note for later work. Image Converter and Canon cameras not showing in Finder Will it show up as a volume if you change the camera communications from PTP (Picture Transfer Protocol) to MSP (Mass Storage Protocol)?