Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is it possible to export all information (metadata, list of pictures within each album or project) about ALL pictures in Aperture to text files, in a single operation?

I have downloaded a trial version of Aperture because I would like to switch from using Picasa and gimp to using Aperture. I already know that I want to use Aperture, and that I cannot learn how in 30 days. I want to use the 30 days to see if I can solve a different problem: bulk export of all information except edits and versions from Aperture.


I want to avoid locking information (other than than the edits and version information that Aperture maintains) about my photos into any one piece of software.


Picasa stores a copy of almost all its information in text filies (mostly XML or .ini format) that are scattered through its picture library. These files can be scanned and found by use of Mac OS X tools that are availabe in Terminal (at the bash command line). All of the information about albums, faces, etc can be exported by a single command (after wtiting the progams that the command will initiate. I have not yest found any similar files in Aperture.


Aperture supports the export of EXIF and IPTC metadata, but only for selected photos, and does not appear to support the export of other information at all.


What I would like to do with a single operation, from either Aperture or Terminal, is to export the entire arrangement of phost ins albums and projects, lists of albums, projects and phots with all metadata (including added keywords) attached to each, and for referenced photos, the external file name. I do not care if would be in one file or many different text files, because Mac OS X provides all the tools I would need to extract the information I would want from any number of text files.


This would allow me to reconstruct all of the information about my photos (except for edits and versions) outside Aperture, and to use that info in a database outside Aperture. I would then be able to use Aperture while still being able to do everything that I could do with Picasa.


The most helpful form of an answer to this question might be a list of places to look in the Apple support and Apple developer documentation. It is difficult to teach me anything complicated, but I am fairly good at figuring out things from documentation.

Mac OS X (10.7)

Posted on Aug 22, 2011 10:47 AM

Reply
Question marked as Best reply

Posted on Aug 22, 2011 12:31 PM

See if the fields included in "Export→Metadata" meet your needs. I'm not aware of any way to customize the fields included.


I don't understand the reason for your quest. As long as Aperture works, you can always:

- Export all your Masters (that is, the unaltered files you imported), and

- Export all of your Versions, with almost all metadata intact (including "face info" and "location info").


You can export into Finder folders by Project or by (Aperture) Folder.


What information is "locked in"? It is true that the database format is proprietary (afaik), but the data seems to be accessible.

14 replies
Question marked as Best reply

Aug 22, 2011 12:31 PM in response to ian129

See if the fields included in "Export→Metadata" meet your needs. I'm not aware of any way to customize the fields included.


I don't understand the reason for your quest. As long as Aperture works, you can always:

- Export all your Masters (that is, the unaltered files you imported), and

- Export all of your Versions, with almost all metadata intact (including "face info" and "location info").


You can export into Finder folders by Project or by (Aperture) Folder.


What information is "locked in"? It is true that the database format is proprietary (afaik), but the data seems to be accessible.

Aug 22, 2011 3:33 PM in response to Kirby Krieger

Thanks for the reply.


I have already tried "Export→Metadata" and it works very well for the pictures you select in one album. I just don't want to export separately for every album and project and for 15,000 pictures. Instead, I want to be able to make a single request and get data about all 15,000 pictures, and also get the information about how the pictures are arranged in albums, projects, and "face" groups, and to get any extra keywords that I have added to each picture. It doesn't matter if the data is one big file, or many smaller files, as long as it is in files that I can figure out how to parse.


Data is not "locked in" if you can export it as text. Moreover, proprietary format does not matter if you can export in a text format. But the data is definitely "locked-in" if I have to go through hundreds (or thousands) of point-and-click operations whenever I want to be sure that I have an up-to-date copy.


It is easy get the data from Picasa because the necessary data is stored as text (Picasa actually uses a proprietary database, but stores nearly all of the data in text backup files). Aperture apparently does not store data as text, but that would not be a problem if a single request could export all of the data as text. Text on demand is just as good as text already in place.


At the moment, the only thing I can think of is to find some way to use Automator to apply "Export→Metadata" tto every photo in Aperture. This would get me all the EXIT and IPTC tags, but not the other data. The Automator actions cannot be extended because they are supplied without source code.


BTW, Aperture supplies an Automator action called "Extract Metadata" that gets all EXIF and IPTC data (the IPTC tags can be found in a .plist file). However, the source code is not available, so the action cannot be customized (or used as a guide to prepare a new action).

Aug 22, 2011 5:58 PM in response to ian129

Like Kirby, I'm not sure why you want to go to all this trouble. Regardless, I doubt Automator is going to handle the extensive set of info you are looking for. Applescript might be able to do it, but even then I don't think data about Albums and Faces is available. The next step up would be using a SQL manager and screwing with the database directly. Sounds like a LOT of work to me.


Interestingly, you can customize the list view to get a lot of what you want, but then you can't do anything with it...like an export, for instance.

Aug 22, 2011 6:38 PM in response to phosgraphis

Kirby says "As long as Aperture works".


I have seen a lot of software and data formats (and computers!) come and go since 1969. Data in a known format is portable, and text data is easy to parse, whether with tools from the 70's or with modern tools like python. Data in a known format is also easy to use in another application - no need to hack any internals of Aperture when all we want is access to the data.


I would not want to do any work directly with the Aperture database. It would be far better to work in some way that was consistent with the tools that Apple provided for Aperture (or OS X) users, instead of refusing to use the advantages of a good system.


Thanks

Sep 2, 2011 2:16 PM in response to ian129

"Aperture 3 AppleScript Reference" ( http://images.apple.com/aperture/resources/pdf/Aperture_3_AppleScript_Reference. pdf ) indicates that I may be able get all of the information I want from Aperture.


In particular, the "containment diagram" shows that a "library" can be used as a top-level object to access all other objects.


I am not yet familiar with AppleScript, but all the other languages I have used would be able to produce both the hierarchy and the content as a text file, thereby producing and external representation of all the information that Aperture holds _about_ the pictures in the library.


Might be the answer i am looking for.

Sep 2, 2011 2:39 PM in response to ian129

I won't comment on the why of what you are doing the others have pretty much expressed my opinion I will comment on the how:


You can use File->Export->Metadata to dump the metadata from your complete library in one step, just select all the images in your library.


Goto the Photos icon of the Library Inspector make sure the browser is up and select all the images. Then run the command.

Sep 2, 2011 7:23 PM in response to Frank Caggiano

But the OP is asking for information that isn't provided by the Export>Metadata function (and that's why using Applescript came up in the discussion):


"What I would like to do with a single operation, from either Aperture or Terminal, is to export the entire arrangement of phost ins albums and projects, lists of albums, projects and phots with all metadata (including added keywords) attached to each, and for referenced photos, the external file name. "


The requested information isn't included in the default export>metadata file, and I don't believe there's any way to customize the output.

Sep 3, 2011 8:17 AM in response to phosgraphis

I was responding to this from the OP:

I have already tried "Export→Metadata" and it works very well for the pictures you select in one album. I just don't want to export separately for every album and project and for 15,000 pictures. Instead, I want to be able to make a single request and get data about all 15,000 pictures




It is possible to have the command run on the entire library, it is not necessary to select individual images or even projects.

Sep 3, 2011 6:17 PM in response to phosgraphis

phosgraphis:


Thanks for the reply. You understand precisely what I am trying to do.


I have confirmed that it should be possible to do what I want with AppleScript, and am close to having a "proof of concept" (in the code at the end of this reply).


I am working initially with iPhoto because I do not want to start my 30-day trial of Aperture until I am able to write AppleScript programs.


The code below starts at the top of the iPhoto tree ("local root albums") and goes through albums and photos recursively. The same apporach should work with Aperture. In either case, the program can be expanded to export everything.


The remaining unsolved problem is to get the data to an output file instead of a log. The "open for access" statement only works if the "with write permission" qualifier is omitted. Unfortunately, I need to write and the default access is read-only. When the "with write permission" qualifier is included, Applescript tells me the file is already open. This is not the case, because, if I use a (try/on error block) to catch the exception, the file turns out to be still closed.


Once I figure out how to get AppleScript to open a writable text file, I should be able to export all information (except actual photo edits) from either iPhoto or Aperture.


I expect to export to an XML file without removing redundant data, and to remove the redundancies in a separate step (much easier to do outside AppleScript).


Best regards and thanks


Ian


<code>

(** List iPhoto albums by name, starting at top level.

Within each album, list photos by file name.

Recurse into child albums.

**)



set outputFile to open for access POSIX file "/Users/ian/prj/sw/AppleScript/AlbumList.txt" # with write permission


# details for one photo

on listPhoto(thisPhoto)

tell application "iPhoto"

-- write (image path of thisPhoto & "\n") to outputFile

get image path of thisPhoto

end tell

end listPhoto


# details for one album

on listAlbum(thisAlbum)

tell application "iPhoto"

# info for current album

-- write (name of thisAlbum & "\n") to outputFile

get name of thisAlbum

# recurse into child albums

repeat with childAlbum in (get children of thisAlbum)

my listAlbum(childAlbum)

end repeat

# photos of this album

repeat with eachPhoto in every photo of thisAlbum

my listPhoto(eachPhoto)

end repeat

end tell

end listAlbum


# start with the top-level albums

tell application "iPhoto"

repeat with eachAlbum in (get local root albums)

my listAlbum(eachAlbum)

end repeat

end tell


close access outputFile

</code>

Sep 8, 2011 7:47 PM in response to ian129

The following script recursively lists the content of an Aperture library. The output is simple, for demonstration puposes, but could be modified to XML. If the XML were that of a PLIST, the Apple Property List viewer oculd be used to diaplsy the output.


A simlar script produces all of the keywords and tags for all of the images in Aperture.


The scripts run much faster in the shell than in the AppleScript Editor bcause the shwll produces no debugging or monitoring information.



#!/usr/bin/env osascript

(* Demo: list the containment hierarchy in Aperture, starting from libraries.

Runs from AppleScript Editor, or as a shell command


References:

Aperture 3 AppleScript Reference Manual,

particularly the Containment Diagram in Appendix A

from the link on "Aperture Resources" web page at http://images.apple.com/aperture/resources/

Aperture AppleScript Dictionary, accessed from AppleScript Editor


Ian E. Gorman

*)


global outputFile

set outputFilePath to "/Users/ian/prj/sw/AppleScript/ApertureContainment.txt"


global lineEnd

set lineEnd to "

"

global tabChar

set tabChar to " "


on writeText(str)

write str to outputFile

end writeText


# Open the file, guarantee closure after any error, and list the contents of Aperture libraries

try

set outputFile to open for access POSIX file outputFilePath with write permission

set eof outputFile to 0 # truncate the file, if it already exists

my listAll()

close access outputFile

on error errorMsg number errNum from offendingObj partial result resutList to expectedType

try

display alert "Operation failed, attempting to close output file" & lineEnd & "Error number " & errNum & ": " & errorMsg

close access outputFile

display alert "Operation failed, but output file has been closed"

on error

display alert "Operation failed, also failed to close output file"

end try

end try


# top-level in Aperture

on listAll()

tell application "Aperture"

repeat with eachLibrary in libraries

my listLibrary(0, eachLibrary)

end repeat

end tell

end listAll


on listLibrary(level, thisLibrary)

local newLevel

set newLevel to 1 + (level as integer)

tell application "Aperture"

my writeText((newLevel as rich text) & tabChar & "library" & tabChar & (name of thisLibrary) & lineEnd)

repeat with eachAlbum in albums of thisLibrary

my listAlbum(newLevel, eachAlbum)

end repeat

repeat with eachFolder in folders of thisLibrary

my listFolder(newLevel, eachFolder)

end repeat

repeat with eachProject in projects of thisLibrary

my listProject(newLevel, eachProject)

end repeat

repeat with eachImageVersion in image versions of thisLibrary

my listImageVersion(newLevel, eachImageVersion)

end repeat

end tell

end listLibrary


on listAlbum(level, thisAlbum)

local newLevel

set newLevel to 1 + (level as integer)

tell application "Aperture"

my writeText((newLevel as rich text) & tabChar & "album" & tabChar & (name of thisAlbum) & lineEnd)

repeat with eachImageVersion in image versions of thisAlbum

my listImageVersion(newLevel, eachImageVersion)

end repeat

end tell

end listAlbum


on listFolder(level, thisFolder)

local newLevel

set newLevel to 1 + (level as integer)

tell application "Aperture"

my writeText((newLevel as rich text) & tabChar & "folder" & tabChar & (name of thisFolder) & lineEnd)

repeat with eachAlbum in albums of thisFolder

my listAlbum(newLevel, eachAlbum)

end repeat

repeat with eachFolder in folders of thisFolder

my listFolder(newLevel, eachFolder)

end repeat

repeat with eachProject in projects of thisFolder

my listProject(newLevel, eachProject)

end repeat

repeat with eachImageVersion in image versions of thisFolder

my listImageVersion(newLevel, eachImageVersion)

end repeat

end tell

end listFolder


on listProject(level, thisProject)

local newLevel

set newLevel to 1 + (level as integer)

tell application "Aperture"

my writeText((newLevel as rich text) & tabChar & "project" & tabChar & (name of thisProject) & lineEnd)

repeat with eachAlbum in albums of thisProject

my listAlbum(newLevel, eachAlbum)

end repeat

repeat with eachSubfolder in subfolders of thisProject

my listSubfolder(newLevel, eachSubfolder)

end repeat

repeat with eachImageVersion in image versions of thisProject

my listImageVersion(newLevel, eachImageVersion)

end repeat

end tell

end listProject


on listSubfolder(level, thisSubfolder)

local newLevel

set newLevel to 1 + (level as integer)

tell application "Aperture"

my writeText((newLevel as rich text) & tabChar & "subfolder" & tabChar & (name of thisSubfolder) & lineEnd)

repeat with eachAlbum in albums of thisSubfolder

my listAlbum(newLevel, eachAlbum)

end repeat

repeat with eachSubfolder in subfolders of thisSubfolder

my listSubfolder(newLevel, eachSubfolder)

end repeat

repeat with eachImageVersion in image versions of thisSubfolder

my listImageVersion(newLevel, eachImageVersion)

end repeat

end tell

end listSubfolder


on listImageVersion(level, thisImageVersion)

local newLevel

set newLevel to 1 + (level as integer)

tell application "Aperture"

my writeText((newLevel as rich text) & tabChar & "image version" & tabChar & (name of thisImageVersion) & lineEnd)

end tell

end listImageVersion

Sep 10, 2011 9:59 AM in response to ian129

I have a similar issue.


I have used Aperture's File > Export > Metadata successfully, however the resulting text file doesn't contain all the info that I want.


In particular, I'd like to capture things like "Camera Model", "Project Path", and if possible, the location of my referenced master images.


I'm not too excited about trying AppleScript, but can I use Automator to export the metadata of my choosing?


Thanks!

Sep 11, 2011 5:40 AM in response to Jim Warthman

Try Automator first, it is a lot easier to use than AppleScript.


You can get any (or all) of the EXIF tags and IPTC tags by making a workflow out of some Aperture actions in Automator. One of the EXIF tags is the camera model.


You can produce a "workflow" that is just as easy to use as any of the menu choices in Aperture.


Use the Aperture action "Get Selected Images" to pick up the images that you have selected in Aperture, and follow it with the Aperture action "Extract Metadata".


Click the "options" button on both actions to see what you can do, and experiment with the options.


I agree with you about AppleScript. Don't use AppleScript until you know that you can't get what you want from the Aperture menus or Automator. I think you will have to have to use AppleScript for some of what you want, but experience with Automator will help when you start using AppleScript.


Best regards


Ian

Sep 11, 2011 1:06 PM in response to phosgraphis

(a) I showed how to get more information from AppleScript in an earlier post. Jim Warthman may be satisfied with what he can get from Automator after he sees how much work is involved in using AppleScript.


(b) Programming is simply the art of using a collection of operators to get the result you want. Operators in Automator are high level, very powerful and closely integrated with the application, but are quite specialized. Operators in AppleScript, are low-level, not nearly as powerful, but are very flexible. It takes a lot more practice to put AppleScript operators together in a useful way. But in either case, the principle is the same: you have to visualize a result, and you have to visualize a collection of steps that will get you to the result.


(c) I have used three or four dozen program languages (or analogues thereof), and have found that the knowledge and practice aquired from any programming language or system is very portable to new problems that are to be solved with a different language or system. A would-be AppleScript programmer would be well-advised to start with Automator.


(d) Familiarity with Automator helps a lot in deciding when _not_ to use AppleScript.

Is it possible to export all information (metadata, list of pictures within each album or project) about ALL pictures in Aperture to text files, in a single operation?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.