Geo-tagging Images

 Roi y Zysman made an entry on his blog about geotagging jpgs images with a few lines of code in C#.   Very useful.  Takn directly from his site:


 appears that it is very simple to read and write these GPS settings from within the JPEG image using .Net’s System.Drawing.Image class.
The data stored in JPEG images complies with the EXIF data format. We can use the Image class to read and write data from and to the JPEG image.
here is an example:
Image Pic = Image.FromFile(Filename);  PropertyItems = Pic.PropertyItems;  PropertyItems[0].Id = 0x0002; //index of the EXIF TAG  PropertyItems[0].Type = 5;//  PropertyItems[0].Len = length;  PropertyItems[0].Value =new byte[length];  Pic.SetPropertyItem(PropertyItems[0]);

And that’s pretty much it, there are a few more tweaks to save the image.
I’m publishing here a small C# file with a static function to perform a simple action to embed GPS latitude, longitude (Which can be taken from the gps log according to time that the picture was taken).
It is pretty much straight forward.
It can be used like so

WriteLongLat(“c:/temp/house_gps.jpg”, 33, 0, 48.46, 35, 5, 38.12);

where the first parameter represents the file name to be embedded and the other parameters represent the lon and lat degrees, minutes, and seconds..
Feel free to use this as will (LGPL) license

“Spark Your Imagination”

As I delve more deeply into mobile development I am considering changing my attention from Windows Mobile Professional to Windows CE  But wait, aren’t those the same things?  No.

What’s the Difference in Windows CE and Windows Mobile

Windows C.E. is a modular embedded operating system.  Developers using Windows CE can can select from a set of of modular components that meet their needs to configure a Windows CE image for their solution.  Windows Mobile is derived from Windows CE.  Windows Mobile is also modular in nature.  OEMs building a Windows Mobile device have a set of core functionality and components that must be installed and then can choose and select from a set of modular components.  They can also add features that don’t exists in the Windows Mobile API.

I have several Windows Mobile devices running Windows 2003 SE, Windows Mobile 5 Professional, and Windows Mobile 6 Professional.  While these serve as nice testing hardware test devices the APIs available to them are more limited.  Windows CE has more potential flexibility.  Acquiring a Windows CE hardware testing platform will be easier than I thought it to be.  Microsoft has a program with their partners called Spark your Imagination to assist developers in acquiring CE hardware  for non-commercial projects.  Some of the features of the kits available through this program are

  • Professional-grade product at an affordable-grade product at an affordable price
  • Support for up to 32,000 simultaneous processes
  • 2 GB of virtual memory space for each process
  • Native real-time OS

I would like to purchase a kit promptly, but I will wait at least three weeks before making a decision so that I can make an informed decision.