iPhoto Diet
iPhoto Diet and iPhoto 7.x (October 22, 2007) Currently, there are several incompatibilities with iPhoto 7 which prevent iPhoto Diet 3.1 from running to completion. For anyone wondering whether an update to iPhoto Diet is in the works, the short answer is, yes! While the incompatibilities are fairly straightforward to fix, there are a couple items that will take a bit more effort to address. First, iPhoto Diet code needs to be refactored into smaller files, as the current main Applescript file has grown to more than 5000 lines, causing XCode to persistently balk at compile time. Even if XCode 3 in Leopard supports larger Applescript files, code refactoring is a GOOD THING for code maintainability, and something I have been meaning to do for some time; the only downside is that it will take some time to retest all the code and make sure it works together from the smaller files. Second, there are some long-standing bugs from the iPhoto Diet 3.1 release that require fixing, if at all possible. The most common bugs crop up as Applescript errors, and I have a list of these that I want to track down (and doing so should be fairly straightforward, just a matter of allocating some time, which has been in short supply earlier this year). The missing photo / grey screen problem that some users have encountered remains elusive, as I haven't been able to reproduce it on my Powerbook. I figure it may be related to something going amiss during GUI scripting, when iPhoto Diet attempts to control iPhoto by automating menu selections and button clicks in the iPhoto interface (because iPhoto doesn't provide sufficient Applescript support to carry out all of iPhoto Diet's actions behind the scenes, via Applescript commands). I intend to look into this issue further, but coming up with an ultimate fix isn't a certainty. In any case, a new version of iPhoto Diet is underway, and will be released when it is ready. During the past few months I have received a couple hundred emails pertaining to iPhoto Diet progress, questions, and bug reports, and while I have tried my best to answer them all, time constraints prevent me from getting back to every one. If you did send me an email, but didn't receive a reply, please do understand that things have been a bit busy, and rest assured that I do actually read every message and take note of all requests, problems, and bugs. Important Note On iPhoto Diet 3.1 I have received several reports of two significant problems in iPhoto Diet 3.1:
These problems appear to affect only some users, and I am attempting to determine a cause and fix (I haven't yet been able to reproduce them on my Mac, but am working with some of the afflicted users to figure things out). The first problem, especially, highlights the importance of backing up your iPhoto library - in case something goes wrong, you'll be able to fast-track back to the way things were. I will keep this note updated as my investigations progress. What is iPhoto Diet? iPhoto Diet is a utility that helps to slim down your iPhoto library by manipulating your photos in the following ways:
These operations allow you to recover hard drive space and to fit more photos in an iPhoto library that you want to burn to a CD or DVD. iPhoto Diet supports multiple iPhoto libraries, and provides basic library management features such as switching and launching libraries. In addition, iPhoto Diet can be run manually or configured to start scanning your libraries automatically at desired times. Precautions iPhoto Diet actively manipulates the photos inside your iPhoto libraries. With iPhoto 6, iPhoto Diet may further manipulate photos outside your iPhoto library, if iPhoto has been set up to reference photos on your drive(s) rather than import them (see this section for more information). For maximum safety of your photos, you are encouraged to back up your iPhoto library folders and any other collections of photos referenced by iPhoto prior to running iPhoto Diet. After you successfully slim down your iPhoto libraries and check that everything is in order, you can remove your backups. Please note the disclaimer!
Drag the iPhoto Diet application to any desired location on your hard drive. Quick Start To get started right away:
As the diet proceeds, iPhoto Diet will automatically communicate with the Finder and iPhoto in order to weed out photos. You should not use iPhoto until the diet has finished. Be aware that iPhoto Diet may switch applications while it is running, preventing you from accomplishing other tasks on your Mac. Getting Started Double-click the iPhoto Diet icon to launch iPhoto Diet. If this is the first time you are using iPhoto Diet, your current iPhoto library will automatically get added to the iPhoto Libraries list. If you are running Mac OS X 10.3 (Panther) or later, you should enable access for assistive devices in the Universal Access pane of System Preferences. This permits iPhoto Diet to make use of GUI scripting, a feature which is necessary for removing originals under iPhoto 5 or 6 and allows photo sort modes to be set for albums created by iPhoto Diet. GUI Scripting means that, occasionally, iPhoto Diet will take control over the interface by bringing iPhoto to the foreground, choosing menu items, and clicking buttons, so it may interfere with other work you are trying to accomplish on your Mac. Due to limitations in Applescript support in iPhoto, GUI Scripting is presently the only workaround for some of the tasks iPhoto Diet is trying to accomplish. Adding, Launching, and Removing Libraries iPhoto Diet has basic management features for working with multiple iPhoto libraries. If you have only one iPhoto library, you can skip over this section. Add libraries to the iPhoto Library list by clicking the "+" button (or type Cmd-A) and selecting them from the Open dialog box. If you select an empty folder, iPhoto Diet offers to convert it into a new iPhoto library. You can also drag iPhoto library folders (or drag an empty folder) from the Finder directly onto the iPhoto Libraries list or onto the iPhoto Diet icon. Libraries in the list are color-coded as follows:
Selecting a library will reveal its path in the status bar at the bottom of the window. Click the triangle-shaped Launch button (or type Cmd-O) to set this library as your current library and launch it in iPhoto. You can select multiple libraries by clicking in tandem with the Shift or Command keys. To remove a library, select it in the list and click the "-" button (or type Cmd-R). This will remove the library from the iPhoto Library list only; the library will remain untouched in the Finder. You can change the name of a library by double clicking it. Note that changing the name in the list view will not change the name of the library in the Finder. Dieting Options - Finder Operations All the options in the Finder Operations box directly manipulate photos and files in your iPhoto libraries by communicating with the Finder and performing UNIX-level file operations. Any photos that are removed from the libraries will be placed in the Dock's Trash. These operations act behind the scenes, targeting extraneous photos and files, so you will not notice any direct changes to your photos and albums when you load up the libraries in iPhoto. You will, however, notice iPhoto 5 or 6 jumping to the foreground whenever iPhoto Diet removes a photo. Remove Original Backups In order to fully understand these options you need to know a bit about iPhoto's inner workings. iPhoto automatically backs up original copies of your photos whenever you make changes, such as rotating an image, adjusting brightness, or cropping. This makes it possible to revert back to the original if you are unhappy with your changes, via the Photos -> Revert to Original menu item. These originals are kept inside one or more "Originals" folders in the iPhoto library and over time add greatly to the library's size. The Remove Original Backups Options will only remove the backed-up originals photos inside the "Originals" folders. In effect, any modified photos or any photos that haven't been backed up by iPhoto in the first place (because you haven't yet modified them) will not be touched. If you are running iPhoto 5 or 6 and wish to remove originals, you must turn on "Enable access for assistive devices" in the Universal Access pane of System Preferences. A detailed (and somewhat technical) explanation as to why this option must be enabled is here. iPhoto 5 and 6 use the "Originals" folders to store two additional file types: movie files and RAW images. These files act as master copies and will not be removed from the "Originals" folders under any circumstances. You can selectively move originals to the Trash by enabling one of the three options below. To remove all originals in your iPhoto library, enable all options. Remember that if you remove all originals, you will be unable to revert to any original photos via the Photos -> Revert to Original command in iPhoto.
Within iPhoto Libraries Only (iPhoto 6 only) When checked, this checkbox tells iPhoto Diet to remove an original backup only if it resides inside the iPhoto Library. If you are running iPhoto 5 or earlier, photos (whether original or modified) always reside in the iPhoto library, and iPhoto Diet will always keep this checkbox checked. By default, iPhoto 6 also places all imported photos within the iPhoto library, but by unchecking "Copy files to iPhoto Library folder when adding to library" in the Advanced pane in iPhoto's preferences, iPhoto simply links to the imported photos wherever they may reside on your drive. If you make any modifications to one of these photos in iPhoto, a modified copy is stored inside the iPhoto library, and the original backup remains in its former location outside the library. When "Within iPhoto Libraries Only" is unchecked, iPhoto Diet will move the original photo outside the library to the Trash, and replace it with the modified photo from inside the library. If you do not want iPhoto Diet to be manipulating photos outside the iPhoto library, make sure to keep this option checked. Other Options The potential disk recovery of the following options is typically not as sizeable as the Remove Original Backups options, but you will be able to regain a bit of disk space and generally clean up your iPhoto library.
Dieting Options - iPhoto Operations Unlike the "Finder Operations" options above, these options manipulate photos solely via iPhoto's interface. Photos will be moved into new albums or iPhoto's Trash. In fact, if you look at iPhoto while these operations are taking place, you will likely see albums being created and photos being moved around before your very eyes. This is normal behaviour! "Move" Options Choose the photos you want iPhoto Diet to identify and move:
"To" Options Choose where you want iPhoto Diet to move the photos:
Executing your Diet After you have selected your libraries and dieting options, click the "Start Diet" button (or type Cmd-S). The progress of the diet will be displayed in the window's status bar. You can abort at any time by clicking "Stop Diet" (or type Cmd-S). Any photos that have already been moved to the Trash or a new album will remain in their new location. The amount of time required for the diet varies depending on the options you chose and the size of your library. Be prepared to spare several hours of computing time for very large libraries (you may wish to let iPhoto Diet run overnight while you are sleeping). iPhoto Diet relies on iPhoto to execute most of its options (only "Strip Icon Thumbnails" and "Remove Leftovers" do not require iPhoto's services). iPhoto Diet will automatically launch iPhoto as required. If you have selected more than one library, you will notice iPhoto quitting and restarting to load each of the libraries. Furthermore, if you have enabled access for assistive devices in Universal Access, you will notice iPhoto jumping to the foreground occasionally, as iPhoto Diet performs menu operations directly in iPhoto. If you are removing originals under iPhoto 5, you will notice a Revert to Original dialog box popping up and being dismissed in rapid succession. This is normal behaviour, and is discussed in detail below. Post-Diet Review Once the diet is finished, iPhoto Diet informs you of the number and total size of photos that have been identified for each of the selected dieting options. Here is where your photos will have ended up. Dock's Trash This is where you'll find photos or files removed by the "System Operations" options. Control-click the Trash and choose Empty Trash to permanently remove them. iPhoto's Trash Any photos identified by "iPhoto Operations" will be moved to the Trash in iPhoto, if this is what you specified in the "To" options. Choose iPhoto -> Empty Trash to get rid of them. You can also restore photos in the Trash back to their original locations in the library and albums by choosing Photos -> Restore to iPhoto Library. If you performed your diet on more than one library, you will need to launch iPhoto and empty the Trash for each separate library. Photos identified by "iPhoto Operations" will be moved to one of three new albums, if this is what you specified in the "To" options:
You can review these albums in iPhoto to make sure that iPhoto Diet identified the correct photos. If imported duplicates are found, iPhoto Diet will generate an additional album named --Duplicates (Keep) --. This album contains all the keeper photos, for the purpose of comparison with the duplicates. If you did not enable assistive devices in Universal Access, you should select View -> Sort Photos -> Manually for both albums before comparing the photos. This way, the first photo in the Keep album corresponds to the first photo (its duplicate) in the Remove album, the second photo in the Keep album corresponds to the second photo in the Remove album, and so on. By selecting all the photos in one of these three albums and pressing Command-option-delete, you can move these photos to iPhoto's Trash. If you rather not delete the photos, simply delete the albums. Relinked Albums You can easily identify all relinked albums by looking for albums with "(Relinked)" appended to the name. If you decide to delete your imported duplicates, you should replace your original albums with the relinked albums. iPhoto Diet attempts to maintain the same manual ordering of photos in the relinked albums as in the original albums. If the ordering appears differently, you may need to select View -> Sort Photos -> Manually for the relinked album (this is automatically done if you have enabled assistive devices in Universal Access). Can iPhoto Diet be set to run automatically at predefined intervals? By clicking the "Auto Start" option, iPhoto Diet will automatically begin scanning the selected libraries using the currently selected options at the next launch. Using this feature in combination with crontabs, you can have iPhoto Diet run automatically at particular times of the day or week, such as night time when your Mac is likely to be sitting idle. In this way you can keep your iPhoto libraries slim and trim without any further intervention from yourself. Umm... cron-what? Cron is a UNIX scheduling facility used by Mac OS X to execute commands, such as opening applications, at predefined times. The commands can be placed in a system crontab file (in /etc/crontab) or in a user crontab file (in /var/cron/tabs/). Although crontab files can be edited by hand, a nice alternative is to use CronniX, a graphical frontend for the cron facility. If you are unfamiliar with crontabs, the help pages for CronniX give a good introductory overview. Supposing you want iPhoto Diet to run every morning
at 4:30 am, enable the "Auto Start" option and add the following entry
to your crontab:
Similarly, to run iPhoto Diet every Tuesday at 10:15 pm, you would add the following entry:
![]() Why does iPhoto Diet generate a sproingy sound while scanning photos? This sound is the Mac's Trash can sound, played whenever the diet in progress moves a photo to the Dock's Trash. If the sound is driving you batty, you can turn it off in your System Preferences: Open the Sound panel, click on the Sound Effects tab, and uncheck "Play user interface sound effects." Can I continue to use iPhoto while iPhoto Diet is running? As a rule of thumb, no. Unlike earlier versions, iPhoto Diet 3 and later is very tightly integrated with iPhoto. In essence, iPhoto Diet masquerades as a user and actively manipulates iPhoto. As a result, you should not use iPhoto until the diet has finished, or else you may interfere with iPhoto Diet's operations. During dieting, why does iPhoto display "Revert to Original" messages when I have instructed iPhoto Diet to remove originals? These "Revert to Original" dialog boxes are rapidly displayed and dismissed by iPhoto Diet while it is removing original photos. This behaviour is normal, and is described in detail here. Why does iPhoto keep prompting me with "Locate original photo" dialogs while iPhoto Diet is running? When iPhoto 6 catalogs photos that reside outside your iPhoto library, and some of these photos have gone missing (either you have deleted them or moved them to another drive), iPhoto requires a bit of help from the user to determine where the original photo has ended up. Because iPhoto Diet constantly queries iPhoto for information about all its photos, iPhoto will pop up a "Locate original photo" dialog when the photo in question cannot be found. You will either have to manually locate your photo or cancel the dialog before iPhoto Diet will be able to continue. iPhoto Diet reports that errors were encountered during the diet. What does this mean? If iPhoto Diet reports that it encountered errors during the diet, it usually means that iPhoto provided insufficient or incorrect information about a photo (eg. iPhoto may have returned a non-existant path). If iPhoto Diet is unable to make use of this information, it skips the photo and counts the incident as an error. The error is automatically logged to the "iPhoto Diet.log" file in the Logs folder of your Libraries folder. The occurence of errors suggests that your iPhoto library's database may be corrupt, or there may be a bug in iPhoto's Applescript libraries. Is iPhoto Diet available in my language? Thanks to the effort of individuals who have provided their time and translation skills, iPhoto Diet includes localization files in several languages. If iPhoto Diet does not open with your language, most likely no translation has been made, or an earlier localization has become outdated. Anyone is welcome to add a new language localization or update an existing localization. Please contact me if interested. If iPhoto Diet presents any problems, such as crashes or AppleScript error messages, please let me know. The following pieces of information will help me to track bugs:
You can also reset iPhoto Diet's preferences to their default state by selecting File -> Reset Preferences. This will reset the Dieting Options and iPhoto Library list. If you have any comments or suggestions for improvements, I'd be happy to hear them. Known Issues The following list indicates several problems I am aware of :
iPhoto Diet is free software, and is my way of saying "thank you" to the many free software and open source projects available for the Mac. That said, I will gladly accept donations if you are feeling generous and would like to provide further incentive for its development. "I went to a diet doctor and in just two months
I lost $300!" (Fozzie double checks his script - he doesn't get
it!) On iPhoto, Originals, and GUI Scripting The following is a technical discussion on the changes required to update iPhoto Diet in order to properly remove originals in iPhoto 5 and 6 libraries. Note that the information about iPhoto's behaviour is based solely on observation, and may not be completely accurate, as Apple does not release any specs on the inner workings of iPhoto. Prior to iPhoto 5, removing backed-up originals from the iPhoto library was a simple affair: you simply removed the image from the "Originals" folder. When you selected the corresponding modified image in iPhoto, iPhoto would immediately scour the "Originals" folder and detect that the backed-up original is no longer present. iPhoto would then disable the Photos -> Revert to Original menu command, and be done with it. You could further modify the photo, and iPhoto would place a new copy of the photo (just before you started the new modifications) in the Originals folder, so you would have a safety net to fall back upon in case you wanted to throw out your new modifications. iPhoto Diet's happy, iPhoto's happy, and all's well in the world. iPhoto 5 appears to have changed its handling of originals. It now keeps track of original folders in its own database, the Library.iphoto file. If you remove a backed-up original without notifying iPhoto, iPhoto consults its database and thinks the original still exists. If you select the corresponding modified image in iPhoto, you'll notice that the Photos -> Revert to Original menu command is still active. The problem is, in reality there is nothing to revert to. When you select Revert to Original, and the original is missing, iPhoto won't do anything. This is potentially misleading for the user, who may think the photo has been reverted when nothing actually happened. In order for iPhoto Diet to remove backed-up originals in iPhoto 5 or later, it must let iPhoto know which originals have been removed, so that iPhoto can update the database. Normally, this is easily accomplished using Applescript, but iPhoto does not provide any Applescript commands for removing originals. So a bit of fancy manipulation is in order: iPhoto Diet now moves the backed-up original to the Trash, and then copies the modified photo to the Originals folder. The idea is to get iPhoto to revert to the original, but because the "original" is now the modified photo, iPhoto will simply copy the original back over the identical modified photo. The point is, this operation will force iPhoto to update its database, so it knows the backed-up original has now been removed. A remaining obstacle is how to tell iPhoto to revert to the original. No such Applescript command exists. The only solution is to use GUI scripting, a feature introduced in Panther which allows a program to manipulate another program's menus and buttons directly. With GUI scripting, iPhoto Diet can select the Revert to Original command and click through the resulting "Are you sure you want to revert?" dialog box. Of course, such direct power over an interface can be a bit of a security risk, and Apple keeps GUI scripting disabled by default. To turn it on, you need to tick "Enable access for assistive devices" in the Universal Access Pane of System Preferences. The drawback to GUI scripting is that the commands will take control of your Mac's interface. The consequences of working with your Mac while GUI scripts are running is akin to two users trying to use two mice and two keyboards on one system simultaneously. Hence, if you are using iPhoto Diet's "Remove All Originals" or "Remove Selectively" options in tandem with iPhoto 5 or 6 (this does NOT affect users of earlier versions of iPhoto), you may find iPhoto rudely jumping in front of the windows you are currently working in, so that iPhoto Diet can issue several interface commands. I wish there was a better way around this, but until Apple can provide a Revert to Original Applescript command, or move away from their "keep-track-of-originals-in-the-database" scheme, this is an inconvenience you'll have to bear with... or maybe not. If you use iPhoto 5 or later and are not bothered by the fact that the Revert to Original menu item is selectable even if the original has been removed, you can bypass iPhoto Diet's slower GUI scripting method by entering the following command in the Terminal. defaults write "iPhoto Diet" originals_fast 1 This will force iPhoto Diet to remove the originals without resorting to GUI scripting to select the Revert to Original command. Turn off this feature by using the same command, except replace 1 with 0. Note that iPhoto Diet automatically uses the fast method of removing originals for iPhoto 4 and earlier, where this method is completely safe. I wrote iPhoto Diet as a utility for personal use, but found it useful enough to release to the iPhoto community. To my knowledge, iPhoto Diet functions as it has been described above. There may, however, be unforeseen errors that result in unintended data loss or damage. I have only had a chance to personally test iPhoto Diet on my own PowerBook G4, and there is no guarantee that it will properly function on all Mac systems. Use iPhoto Diet solely at your own risk. For maximum safety always back up your iPhoto library before using it with iPhoto Diet. When people’s houses are on fire, what’s
the first thing they save after their pets and their loved ones are
safe?
The family photos. Version History 3.1 (September 10, 2006)
3.0.8 (October 14, 2005)
3.0.7 (July 7, 2005)
3.0.6 (May 13, 2005)
3.0.5 (April 12, 2005)
3.0.4 (March 15, 2005)
3.0.3 (March 5, 2005)
3.0.2 (March 2, 2005)
3.0.1 (March 1, 2005)
3.0 (February 28, 2005)
2.1.6 (January 16, 2004)
2.1.5 (November 25,2003)
2.1.4 (November 18, 2003)
2.1.3 (November 11, 2003)
2.1.2 (November 2, 2003)
2.1.1 (July 24, 2003)
2.1 (July 16, 2003)
2.0.2 (April 21, 2003)
2.0.1 (April 14, 2003)
2.0 (April 12, 2003)
1.0.3 (January 13, 2003)
1.0.2 (October 7, 2002)
1.0.1 (October 5, 2002)
1.0 (September 18, 2002)
|