One of the things I didn't like about the first iPhoto was that I could use it to organize my photos, but couldn't use that information for anything useful, such as in cooperation with my online gallery. Well, that may be changing. With iPhoto 2, I can use Apple events to find out which photos are in which albums, and find out the relevant information of each photo, so I can regularly run a script that will suck out the information from iPhoto, and then update the information in the MySQL database. It will be pretty simple, actually, with Mac::Glue. I'll whip something up when I get around to it (when I get my computer back ... grrr ...).
Is iPhoto's storage format known? I read somewhere that starting with Keynote (and following up on the preferences and stuff), Apple was to use XML as the storage format for an increasing number of its apps. Not to over-pitch XML (especially as Keynote's format could be much improved upon, notably by using SVG instead of copying it) but it would make export trivial, could be used directly in AxKit's image gallery, would allow one to search for pics using Find::File::Rule::XPath, etc.
robin, who's to get an iBook real soon now...
Re:format?
pudge on 2003-02-01T17:13:43
I've not looked for iPhoto 2, but that's a good question. When I get a chance, I'll find out. I know iPhoto v1, it was not XML.Re:format?
ziggy on 2003-02-01T17:13:49
I don't condone what Apple did, but I don't condemn them either. Even Tim Bray has said on occasion that it is more important to start using XML than to wait for a nice-sounding whiz-bang specification to gel.Not to over-pitch XML (especially as Keynote's format could be much improved upon, notably by using SVG instead of copying it)I was in a position when I needed an Schema language for XML in 1999. Shortly thereafter, we needed an XML Query language for the same project, just before the first XML Query notes were published. Had we waited for XML Schema to work out, that project might still be in development instead of shipping for 3 years. Double ditto for XML Query. (It also helps that this was an internal project; the internal use of XML was an implementation detail, much like the use of XML as Apple's PList and Keynote Formats.)
If I were to start that project today, I might still be tempted to do something similar again. Instead of fighting with a spec like WXS or implementing Relax NG (assuming Daniel Veillard wasn't already doing it, and I couldn't use TRANG), it would be a better use of precious developer resources to develop the simplest XML language that could possibly work and move on from there. Keynote didn't develop overnight; it sounds like Steve has been using it for 2-3 years, which means that the project is likely 3-4 years old. Going back that far, it is possible that the Keynote development team had to make similar tradeoffs and came to a similar conclusion. Were they starting today, I think it would be much more probably that they would start with SVG from the beginning.
Yes, it is better to use standards instead of reinventing them poorly. I don't know the constraints of the Keynote team, but their situation could have been similar to other projects where it was too expensive to implement a full standard or wait for a standard to gel.
Re:format?
darobin on 2003-02-03T09:41:44
Oh I know that ad hoc is good, I'm a great advocate of using ad hoc vocabularies and do so whenever there is no existing solution that satisfies me (which is why I never use DocBook, only convert to it).
However SVG 1.0 has been around for a while, and Apple was on the WG. I know they wanted to use it for some OS X stuff but had to ship earlier than the spec was released. However I am having some trouble understanding why they're using things like
<g transformation='1 0 2 2 3 6'>
instead of<g transform='matrix(1 0 2 2 3 6)'>
when that syntax has been around a long time and they took part in shaping it. Looking at the vocabulary closely, it really seems to me that they in fact were using quasi-SVG and went to some pains to change the names:) Also, Keynote might have been around for a while, but it's been industrialised now. Changing an XML format is trivial in any well built app (a simple reader, a simple writer), and I do expect support for a spec from companies that helped write it
:) Re:format?
pudge on 2003-02-03T13:49:29
It looks like most, but not all, of the info I need is in AlbumData.xml, including a list of all the images, with title, date, filename, comment, and unique iPhoto ID.
It does not include heigh/width, though, which is important for my use; however, I could get all the info from the XML and from there query iPhoto via Apple events for the dimensions. Actually, what I really need is not dimensions, but degrees of clockwise rotation. It looks like iPhoto does not store that information at all, or at least not in any way I can retrieve it via the XML or Apple events. Grrr. If I only need dimensions, I could get those via Apple events, or with a combination of thumbnail path (also in the XML) and Image::Size.
Ugh, and Date is messed up. In the XML, there is Date, which is the date of import, and ModificationDate which is the last time the photo was modified, either the date of the photo on disk (not sure if it uses the filesystem or EXIF data... I think it is the former), or the date you last modified the picture, but it is not updated when you modify any part of it, just some parts of it. There is no way to get the assigned Date except via Apple events, and no way to get the Modification Date (which would be useful for synching if it were more comprehensive) except by XML. My head hurts.
Also, the Date in the XML is not the Date of the image, but the Date of import. Unuseful to me. I could make use of ModifiedDate for the purpose of synchronizing metadata between iPhoto libraries, though.Re:format?
darobin on 2003-02-03T14:01:45
Is there any chance that the rotation would be in the EXIF data? There's a field for orientation so there could well be more info.
For my needs I don't mind throwing in a small SAX filter to add the dimensions, it's cool to know that it's XML so that I can think about building drop in apps for AxKit and that kind of stuff I use. Thanks for the info, hopefully I'll have my iBook soon enough to play with that kind of stuff
:) Re:format?
pudge on 2003-02-03T14:26:05
A good idea, but apparently not.So even in iPhoto's copy of this image, which was flipped upside down in iPhoto, the orientation remains unchanged in the EXIF data (for some value of "unchanged"$ exifdump./iPhoto\ Library/2001/07/23/Originals/DSCN0357.JPG | grep Orientation
Orientation -> top_left
$ exifdump./iPhoto\ Library/2001/07/23/DSCN0357.JPG | grep Orientation
Orientation -> [top_left,top_left]
$ exifdump./iPhoto\ Library/2001/07/23/Thumbs/10.jpg | grep Orientation ... it rewrites the EXIF data, but doesn't properly modify the Orientation field). Both my camera, and iPhoto, apparently ignore this data. It does properly modify the height and width tags, but not the Orientation tag.
Also, iPhoto throws away my CoolPix-$foo tags from the EXIF. These don't matter a LOT, but it sucks to lose them. Right now I don't care much, since I am using the originals, but in the future I might want to use iPhoto also to modify the images themselves, and in that case, I lose the data. Of course, if I do go this route, I don't have to worry about orientation, since the version I will be using online will be oriented properly already. But that's all down the road.