18 December 2006

Vista Image XMP Tags

Microsoft Windows Vista lets you set various meta-data properties for image files, ie JPEG and TIFF files. A new feature is to add one or more Tags to a picture.

Previously, meta-data information was added to image files using EXIF (Exchangeable Image File Format). However Vista adds image meta-data using XMP (Extensible Metadata Platform) - this is XML-formatted information embedded in the image file. Click here to get the XMP spec. Where possible the meta-data is also stored in the corresponding EXIF data.

Using the ASP.NET System.Drawing.Image class, it did not seem to be possible to extract the XMP data in a JPEG file. The XMP is stored in an APP1 section. To find it, I therefore did a somewhat nasty binary scan for these 29 characters http://ns.adobe.com/xap/1.0/ and then checked for the APP1 marker 0xFFE1 two words before. The first word beforehand then contains APP1 size. The XMP Packet byte[] can then be extracted and decoded from UTF-8.

For TIFF files, System.Drawing.Image returns the XMP byte[] data as property id 700.

For both file types, the XMP Packet can then be loaded using System.Xml.XmlDocument. The actual XML lets you extract data from these fields (the Vista usage is in brackets):

  • dc:subject (Tags)

  • dc:title (Title)

  • dc:creator (Author)

  • dc:description (Subject)

  • dc:rights (Copyright)

  • tiff:artist (Author)

  • exif:UserComment (Comments)

  • xmp:Rating (Star rating number)

  • MicrosoftPhoto:LastKeywordXMP (seems to the same as dc:subject)

  • MicrosoftPhoto:Rating (not sure what this is)

The actual field values are in plain text, rdf:Bag, rdf:Alt or rdf:Seq lists.

I did this work to add the meta-data information to that found by my ASP.NET search engine FindinSite-MS.

11 December 2006

Microsoft Windows Vista Multi-boot

I got a new hard disk to work with Vista (as well as to cope with bulging photo files etc). I currently use HyperOS to multiboot between various Windows systems - one on each partition - although I virtually never boot into systems prior to XP nowadays.

I installed the new Barracuda drive as the second drive on the system and partitioned it into 5 chunks using Seagate's DiscWizard, ie one primary partition and 4 logical partitions (in an extended partition).

After a bit of heartache I am now in the position where the Vista bootloader presents these three options at startup:
* Earlier version of Windows
* Microsoft Windows Vista
* 95 98 ME Systems
The "Earlier version of Windows" option boots into the current HyperOS-selected version of Windows.

The main point to notice is that when in XP I have various drives on Disk 1 labelled C: to M: with Disk 2 showing up as N: to R: and DVD drives as S: and T:.
However when in Vista, Disk 2 shows up as C: to G:, the DVDs as H: and I: and Disk 1 as J: onwards. This scenario might require careful handling if you have shared data or batch files etc.

To get to this happy situation required some work. An initial new install of Vista from one of the XP instances led to a hung boot. After getting over the initial panic, changing the BIOS boot order to boot on an XP boot CD let me go into a Recovery Console. The fixmbr and fixboot commands restored the old status quo.

(Each disk has a Master Boot Record (MBR) with load code and basic partition information. In addition, each partition has a volume boot record that contains the real OS loader. The fixmbr and fixboot commands restore the XP loader (NTLDR) for these boot records. The HyperOS cobblerx command also restores the XP MBR.)

The Vista boot loader (BCD) has a new MBR and volume loader (WINLOAD). The load information is stored in the C:\BOOT\ directory in the BCD file.

An easy way to cope with the BCD from XP and Vista is to use NeoSmart's EasyBCD tool - it seems like you must have the .NET framework 2 installed to use EasyBCD.

Perhaps the trick to installing Vista might have been to *first* use EasyBCD to install the Vista Master Boot Loader before starting the install.