25 May 2007

Photo Published Online

I just had one of my photos of the Pont Du Gard published online by the European Travel Commission.

It's at the bottom of this page.


24 May 2007

Followup on the Applescript

Here are some of the technical details about the Applescript I mentioned Yesterday.

The first key line of the code I added to Mr. Gross' Applescript, is just a list of the EXIF tags I want to grab. Not exactly anything fancy, but this actually requires a modicum of thought, since, by default, exiftool will output the fleld names in a human readable format with spaces, but in order to keep the command-line happy is to use the form of the tag without spaces. It is usually pretty easy to figure out.

set DesiredEXIFData to "-LensID -Lens -LensType
-FocusMode -FocusDistance
-AFMode -AFPoint -AFPointsUsed
-ShootingMode -MeteringMode
-Flash -FlashSetting -FlashType -FlashMode"

I chose tags that I think would be interesting and help me learn as a photographer. Some are redundant - Lens ID, for example, is a superset of "Lens" and "Lens Type". I also added a couple that Aperture will read, such as "Flash". The trouble is, Aperture will only print "0" or "1" for flash, or something else similar. I understand the binary thing, but sometimes the number is "2". Exiftool will report this field as words with meaning: "flash did not fire" or "flash fired, return detected".

The tags need to start with the "-" character. And they shouldn't end with an "=" or you will erase the value in the source file. (By default, exiftool only does potentially destructive things after making a backup).

I decided to separate the fields desired from the actual call to exiftool, because I was distributing this script to the rest of the world and recommending that the user edit the desired fields based on their own needs and equipment. I figured it was harder to screw up the whole shebang this way.

-- Ask exiftool for tab-separated fields
set output to do shell script "exiftool -t " & DesiredEXIFData & " " & (quoted form of m_imagePath)

Pretty self explanatory. The "&" symbol is Applescript's text concatenation symbol. It's how you stick the fixed command stuff to the variable stuff.

Sharp readers will notice that I don't provide the full path to exiftool. That might come back to bite me sometime. The thing is, I don't have any idea if I installed it in the standard location or not. And I have no idea whether the end user will either. It works for now, so I am gonna live with it.

Now that we have the exiftool output, I have to do something with it.

-- Separate output by lines
set output to the paragraphs of output
-- Tell Applescript that tab is the delimiter
set AppleScript's text item delimiters to {ASCII character 9}

The exiftool argument "-t" will output the outputs the field name and the field value separated by a tab.

-- Do the following for each line of output
repeat with fields in output
-- split line into two fields
set fields to fields's text items

fields's? cringe!

-- the next two lines are probably not needed, but it makes things easy to read
set MetadataField to item 1 of fields
set MetadataValue to item 2 of fields

-- this does the actual write to the aperture database
tell curImg
make new custom tag with properties {name:MetadataField, value:MetadataValue}
end tell
end repeat

I think between the comments and Applescript's syntax, it is pretty easy to figure out what is going on.

Speaking of Applescript syntax, I think it is great at how readable it makes the code. But I always find myself struggling to try to figure out how to write it when I am coding something myself. Coming from C or Perl or bash, I find it frustrating to try to figure out how to string together things to make a working program.

Well, that's all I added to Mr. Gross' Applescript. I tested it quite a bit before I unleashed it upon the world. Within a couple hours, someone had come up with a fix for the one known bug that I decided I didn't want to fix because it rarely affected me (and never after I figured out what caused it).

There are at least two people who have tried it out, it worked for them and they like what it does. Feels good to give something to the world.

Labels: , ,

23 May 2007

My First Ever Applescript

A discussion on dpreview.com about Aperture and how it doesn't read maker note EXIF fields, specifically the Lens ID, got me thinking. The wonderful exiftool can read this data, why can't Aperture with its team of crack Apple programmers?

I thought of a workaround. Aperture supports the addition of arbitrary metadata to images, and I use it for things like saving the URL and flickr ID of the photos I upload there. Why not read the data from the image using exiftool and stick the result into a new custom field.

I have diddled around with Applescript in the past, but never really did anything that worked. I got bits & pieces working here and there, but never finished because the need went away, I figured out how to do it some other way (like in Perl), found someone else's solution or some similar result. This task didn't seem too hard, so I poked around and found out that there is Applescript support to write custom metadata.

I then encountered the big hurdle. Talking to Aperture with Applescript is easy and you can do a lot of stuff, but everything is relative to the program's internal database, yet I need the path to the actual image file so that exiftool can do its thing. I didn't see an easy way to get Aperture to reveal a path to the original file or get a reference to the image in Aperture's database based on the path of the image file.

Frustrating! I know both bits of data, I just had no clue how to use them to get to my end result. And I still don't, really, because somebody else figured it out and did the heavy lifting for me: Brett Gross' "Reveal Photo File" Applescript. This handy tool will reveal in the Finder the currently selected image(s) in Aperture. Mr. Gross was kind enough to distribute his Applescript in a readable form, so I was able to yank out the bits that open the finder window and instead squirt the path over to exiftool, get the data I need and then write it back to Aperture.

Extended Metadata in Aperture

So now this script is chugging away on my 15k images. It's not the fastest, but most of the slowdown seems to be due to the size of my Aperture library. I tried it on a smaller library of about 200 images and it was done in a minute or two. The current task has been running for a couple days, and at the rate it is going, it will require a couple more. Really strange. And frustrating, because my CPUs are never going above 50% utilization and I have a >1GB of free RAM. I guess the disk is the bottleneck here. I just don't understand why the execution time is so non-linear.

My next step will be to write a new version of the script that will do this all at import, which I hope will be faster.

Please read my post at dpreview.com for the download link and instructions for use.

Labels: , ,

10 May 2007

A Visit From Flat Stanley

Flat Stanley came to visit us from a friend in Colorado. He happened to show up just before we left on a vacation with Jeannette's sister and her husband, so Stanley got to see some cool stuff.

Day 1 (Saturday)

The first day he was here, we tried to take it easy, since he had jet lag, so we wandered around Heilbronn.

When we left our apartment, he immediately saw the playground in front, and wanted to play. Jet lag? Yeah, right. Jeannette and Stanley played a bit, but eventually I had to be the big meanie and tell him that he could play on a playground in Colorado just as well as he could here, so we were going to go out and see some special things he could only see in Germany. Stanley knew I was right, so he wasn't too mad about having to stop playing.

We started our stroll along the Neckar river. Behind Stanley, you can see three important things. First, there is the Taxi Boat - it is just like a normal automobile taxi, but it goes up and down the Neckar river, taking people where they need to go. Next to the Taxi Boat you can see the Heilbronn flag. It looks just like the French flag turned on its side. You can also see a tower, called the Götzenturm, or Götz's tower. It was built about 500 years ago, and at that time it was called "the new tower", but soon it was used for a jail for a knight by the name of Götz, and since then it has been called the Götzenturm. The tower was part of the defensive wall that was around Heilbronn, used in the middle ages to keep invading armies out of the city. Now the wall is gone, because the city grew too much to fit inside it. All that remains of the old wall is this tower and another tower that Stanley will visit later.

Next we saw the Rathaus, or City Hall. It stands in front of Heilbronn's market square, where in addition to the farmer's market on Tuesday, Thursday & Saturday where we can buy fresh fruit, vegetables, cheese eggs and meat, we have festivals. Unfortunately, there was no market or festival on the day Stanley visited, so the market square is almost empty. The city of Heilbronn has a webcam in the market square where you can check to see if anything exciting is going on. Just click here. Remember that it is 8 hours later in Germany than Colorado, so check in the morning or it might be too dark to see anything!

The Rathaus has a very beautiful clock on the front. This clock tells us more than just the time. We can see the phase of the moon (the upper circle), in the center we can see the time, and at the bottom we can find the day of the week and the day of the month. In the basement of the Rathaus is a nice restaurant where you can eat yummy specialties from Swabia, the region of Germany where Heilbronn is located.

Across the market square from the Rathaus is the Kilianskirche, or the church of St. Kilian. St. Kilian brought Christianity to this part of Germany many centuries ago, so he is a very important figure for the Christian population here. The church was built about 600 years ago, but, like most of Heilbronn, was very badly damaged in World War II (more on this later). It has since been repaired, and looks quite beautiful.

Next we saw the Bollwerksturm, which, like the Götzenturm, was part of the medieval city wall of Heilbronn.

In this picture, Jeannette and Stanley are standing on the Adolf Cluß Brücke (bridge) with the fountain in the middle of the Neckar river behind them. During the winter, when the fountain is turned off, there is a family of herons that live on the small island formed by the fountain. The Adolf Cluß Bridge is named after one of the famous residents of Heilbronn, Adolf Cluß. He was an architect who moved to the USA shortly before the American Civil War. He worked for the Army during the civil war, designing cannons. After the war ended, he stayed in Washington DC and designed over 70 buildings there, including one of the buildings of the Smithsonian Museum. We are very proud of him here in Heilbronn, but unfortunately after a century, only a couple of his buildings are still standing. You can learn more about one of Heilbronn's most famous citizens at both Wikipedia or at adolf-cluss.org.

Stanley also got to see the Trappenseeschlößchen, or the "small castle" on the Trappensee. Currently this building is an auction house, and it is the oldest existing secular building in Heilbronn.

At the Trappensee, we started a hike in the forest on the edge of town.

One of our two destinations for the hike was this small chapel in the woods. It was an important place because there is a natural spring here.

Our final stop was at the Ehrenfriedhof, or the memorial cemetery for the victims of the air raid on Heilbronn on December 4th, 1944. On that evening, 255 British bombers dropped thousands of bombs on the city of Heilbronn. After about 25 minutes, 6530 people were killed, among them over 1000 children. 4985 of these victims are buried here, in a collective grave.

Day 2 (Sunday)

Jeannette's sister and her husband were coming today, and while we waited for them to arrive, we had breakfast. Stanley enjoyed his pretzel, and he was so full after eating it, he jokingly said that we should call him "Fat Stanley" from now on.

Stanley has just met his long, lost cousin from Berlin, Ampelman. Actually, this sign is made in the shape of the "don't walk" lights from the former East Germany. Ampelman just means "Stop Light Man".

He and his green brother are very popular symbols in Germany, and the people in Eastern Germany are very proud of him. Most people think that these crosswalk symbols are much more fun than the lights almost anywhere else.

After Brigitte and Randy arrived, we all went to Untergruppenbach, a small town outside of Heilbronn that has a nice castle, called Burg Stettenfels. There was a renaissance fair there, and we got to see lots of knights with swords and armor. We even got to see one of them slay a dragon.

That worked up a big appetite for all of us, so we went to a special restaurant for the region called a Besenwirschaft, which simply means "broom restaurant" in English. The reason it is called a "broom restaurant" is sort of a long story, but I think I can explain it. One of the most important agricultural products in the region around Heilbronn is wine - there are vineyards everywhere and there are a lot of small farmers that make their own wine. These small-time wine makers are allowed to have a restaurant to help sell their wine, but they are only allowed to be open for short periods of time every year. Because they are limited in how long they can be open, the various "broom restaurants" will stagger the weeks that they are open, and the traditional way to advertise that they are open was to hang a broom in front of the winemaker's house. The restaurants can only serve simple foods, so professional chefs are not allowed. It is always a friendly place, because there are never enough tables for all the visitors, so you almost always have to share a table with strangers. Stanley had a lot of fun (he didn't drink wine though!) and his new favorite food is Krautspätzle, which is noodles and sauerkraut.

Day 3 (Monday)

Today we went to Heidelberg. Stanley was excited about riding the trains, so he wanted to document everything. The day started at the Heilbronn Hauptbahhof (Hbf), which means "Main Train Station".

Here Stanley and Jeannette are getting on board.

Stanley is in his seat, ready to go. That kid packs a big backpack!

On the way to Heidelberg, we passed by the Audi factory in Neckarsulm, just north of Heilbronn. I snapped a picture of the hundreds of brand new cars, some of which are on a train as they come out of the factory. The train was going too fast for Stanley to be in this picture - we didn't want him to get sucked out the window!

Heidelberg is probably best known for its gigantic, but unfortunately ruined, castle. Here you can see most of it, along with Randy, Brigitte, Stanley & Jeannette. It is on top of a big hill, looking over and (at one time) protecting the town below.

Here is Stanley, posing with the stone guardians at the main gate of the castle.

This is one of the big towers of the castle, that was partially blown up when the French army ruined the castle in 1693.

Stanley and Jeannette are looking out one of the windows of Heidelberg Castle.

After visiting the castle, we explored town. It is "Spargel" season in Germany, and there are piles of asparagus everywhere! Almost every restaurant has a special menu with asparagus dishes during this time. Stanley didn't know that Asparagus came in different sizes and colors.

In addition to the castle, the "old bridge", as it is called, is another famous site in Heidelberg.

There has always been a monkey statue at this end of the bridge in Heidelberg, but this new brass monkey, that funky monkey, was put there in 1979. It supposedly gives you good luck if you touch it, and Stanley figured it would be even better luck if he got his picture taken with it!

On the bridge behind the monkey, you can just barely see the high water mark for the Neckar river in Heidelberg.

While we were in Heidelberg, we also got to see a protest march parade though the old part of town. These people were protesting the upcoming G8 summit that will be happening in Germany in a few weeks.

Unfortunately, we had to get back on the train and go back to Heilbronn. But Stanley wasn't sad, because waiting for us back in Heilbronn was the May festival - a big carnival with rides and bands (and concession stands in the shape of giant corn cobs!).

Stanley had fun on the Ferris wheel and singing along with the band. The dance floor was a bit too crowded for Stanley to pose with the band, and it was too dangerous for Stanley to stand up on the Ferris wheel, so unfortunately we don't have any pictures of him at the festival.

Day 4 (Tuesday)

Today is May 1st, a holiday in Baden-Württemberg and much of the rest of Germany. We decided to spend the day with Jeannette and Brigitte's grandmother, aunts and uncles in Urloffen.

But first, we had to get on a different train to get there. On this train, Stanley could look at the driver's controls.

We stayed with Karl & Mathilde, Jeannette & Brigitte's great uncle and aunt. They are farmers, they grow apples, pears, plums, strawberries and cherries. They also have some free-range chickens for fresh eggs. These chickens will jump up in the air and take food out of Karl's hands, which is always fun to watch.

Urloffen is a small town, too small for castles and palaces and giant churches. But they do have a stork family that lives on top of a building downtown. It is a very tall, narrow tower that they use to hang up the fire hoses to dry.

We spent the day visiting with family and eating cake. It was a good holiday!

Day 5 (Wednesday)

Today we took another train, this time to München, or Munich in English. München is the 2nd largest city in Germany, and is in the heart of Bavaria, the largest of the German states.

The first thing we saw was the really, really tall Frauenkirche.

We then saw the city hall in München, but unfortunately it was being repaired so it was mostly covered with scaffolding. We did find the inner courtyard, where there were some gargoyles that Stanley liked. These are just fancy waterspouts for directing the rain water away from the walls.

We also saw Schloß Nymphenberg, a big palace in München. The palace is surrounded by beautiful gardens full of swans, geese and ducks.

The swans were very playful, and some of them even ran over to us to meet Stanley.

You can't go to München without seeing a Biergarten, a place where people meet, talk and relax in the fresh air under the shade of chestnut trees. That also usually means drinking beer. Stanley didn't drink any, but he did want to have his picture taken next to one of the giant beer glasses, called a Maß.

Day 6 (Thursday)

Today was a hard day for Stanley. We visited Dachau, the site of the first concentration camp in Nazi Germany and now a memorial to those that died there and a reminder to the world of the atrocities that were committed there, with the goal of making sure that we never forget it, and that it cannot ever happen again.

Because it is impossible visit Germany (with the intent to learn something about the people, history and culture) without dealing with the Nazi times and World War II, we didn't want to skip this in Flat Stanley's travels. Obviously the lighthearted nature of the previous days with Stanley can't be maintained here. We felt the smiling Stanley posing here was inappropriate in this place, so you won't find Stanley in photos here.

I think other web resources, such as the official Dachau Memorial web site or Wikipedia can fill in the details about the concentration camp at Dachau, but here is my short take. The camp was established in 1933 and became the model for other concentration camps throughout Germany and the occupied lands. Between 1933 and 1945, approximately 200,000 people were imprisoned and used for slave labor here, simply because of their political or religious beliefs, their sexual orientation or their nationality. Over 32,000 of those people died here, usually from disease or malnutrition. Of those 200,000 prisoners that didn't die here, many who were too sick, injured or otherwise unfit to work were shipped off to other places to be killed.

Day 7 (Friday)

Today Stanley got to go to the very southern border of Germany, into the Alps, and see more castles. The Alps are Germany's tallest mountains, and to Stanley, look quite similar to the Rocky Mountains in Colorado. The Alps are not nearly as high as the Rockies, but they are still impressive mountains.

The first castle we saw was the famous Neuschwanstein castle. It was built by King Ludwig II of Bavaria in the 19th century. It is probably the most popular tourist destination in Germany, but photography wasn't allowed inside so we only have outdoor shots of Stanley. The castle is a candidate for one of the "New 7 Wonders of the World". More information about the castle, as well as pictures of the inside, can be found at the Neuschwanstein Official Web Site.

After seeing this fancy and relatively new castle, we hiked over to the ruins of the castles Hohenfreyberg and Eisenberg, two late medieval castles that were left in ruins by the Austrians as they left this area in the 17th century. Now they are a pleasant and relaxing place to hike & explore, away from the crowds at Neuschwanstein.

Finally, after all that hiking we took a ride down a "Sommer Rodelbahn". In the winter, it is a bobsled track, but after the ice has melted away, people can ride down the track with a special sled with wheels and brakes.

It was a long trip and we all had a lot of fun, but the next morning, Stanley had to climb back in his envelope and go back to Colorado.

I hope you all enjoyed reading about Stanley's adventures in Baden-Württemberg and Bavaria, and I hope that the pictures help you visualize everything that Stanley got to see.

If you want, you can see all of these photos on a map.

Labels: ,