Folks, just a heads up. Last night I was tweaking some old code that scans
image files in folders and builds an "index" of them all in a SQLite DB. I
wanted to extract some of the meta data from the images and add them to my
tables, and I expected this to be a nightmare due to differing standards and
lack of managed support, but it wasn't quite as bad as I thought.

 

It turns out the System.Drawing.Image class has a PropertyItems
<http://msdn.microsoft.com/en-us/library/system.drawing.image.propertyitems.
aspx>  property where each array item contains the Id, Len, Type and Value
(byte[]) of the property. The various Id values are described HERE
<http://msdn.microsoft.com/en-us/library/ms534416(v=vs.85).aspx#_gdiplus_con
stant_propertytaggpsver> . So you can loop through these things to get
shutter speed, time taken, GPS position, etc. My EOS 400D even embeds a 8K
thumbnail in the picture.

 

The only pain is that the byte[] values of each item can be in one of
several possible formats and you've got to jiggle the bytes around to coerce
them into a nice CLR type.

 

So it wasn't so bad after all. I don't know how many popular image types
(jpg, gif, tiff, bmp, etc) are capable of holding metadata, or if there is a
standard that allows the Image class to magically parse these properties
reliably in all cases.

 

OOOH! I just thought of something awful non-coding related ... What image
editing apps preserve the properties when you alter an image. I often use
the ancient ImageComposer 1.5 (anyone remember that?) and I know it loses
the properties on save. I just ran an experiment with PaintShop Pro 7 and it
also loses the properties. For each test I loaded a large Canon camera
photo, resized it down and saved.

 

Greg

Reply via email to