advertisement

Article:
  Cleaning iPhoto
Subject:   Use the Force, Luke.
Date:   2005-01-21 11:07:30
From:   pixel
Response to: Use the Force, Luke.

ok, so that might be shortened, and it MIGHT work faster, but it sure eats up memory for some reason. I killed iPhoto after it ran for 20 minutes, was using over 500MB of physical and 1.5GB of virtual memory... and it was steadily rising. Anyone have any ideas?
Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Use the Force, Luke.
    2007-02-15 17:19:36  paulskinner [Reply | View]

    In this shorter version you're asking Applescript to first iterate through every item in your library and retrieve the properties from each one of them, then compare two values from those properties to your given values. After this you then have it store the items that match the range you test for into a list. It may be storing a reference (memory cheep) or it may store the value (memory expensive) of the database entry.

    This is indeed very inefficient despite being concise.

    This version is more memory and processor efficient. I ran it against my 22000 image library and checked 5500 in ten minutes.


    tell application "iPhoto"
    tell photo library album
    set c to count of photos
    repeat with myIndex from c to 1 by -1
    tell photo myIndex
    set {thisWidth, thisHeight} to {width, height}
    end tell
    if thisWidth < 200 or thisHeight < 200 then
    remove photo myIndex
    end if
    end repeat

    end tell
    end tell