[Talk-GB] Cameras?

Ed Loach ed at loach.me.uk
Thu Sep 11 20:58:23 BST 2008


Sometime ago I wrote:

> I'd like a cheap digital camera to use when I'm out noting
> things for mapping purposes; our existing camera eats
> batteries.

Firstly thanks for all the advice, but in the end I decided the
camera on my phone was of adequate quality. 

I had tried using it once before, but it (a Nokia 6300) doesn't
write the time the phone was taken into the EXIF properties used by
JOSM when I import images against a trace. However, the date created
property of the file itself was correct, and I've just written a
program (VB 2008) which copies the date created file property into
the EXIF image property - tag ID 36867 as per the document here:
http://www.exif.org/Exif2-2.PDF
and a code example from here:
http://www.eggheadcafe.com/articles/20030706.asp
that I converted to VB and then changed to loop through all JPG
images in a folder selected with a FolderBrowserDialog.

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnStart.Click
        'Get list of files in directory
        Dim objFolderInfo As System.IO.DirectoryInfo = New
System.IO.DirectoryInfo(FolderBrowserDialog1.SelectedPath)
        For Each objFileInfo As System.IO.FileInfo In
objFolderInfo.GetFiles("*.jpg")
            Dim strFilename As String = objFileInfo.FullName
            lstProgress.Items.Add(strFilename)
            Application.DoEvents()
            WriteNewDescriptionInImage(strFilename,
Format(objFileInfo.CreationTimeUtc, "yyyy:MM:dd HH:mm:ss"))
        Next
    End Sub

The main changes to the code example were to get the correct tag ID
in a valid PropertyItem, hardcoding the length to 20 (as per spec
document above, where Type 2 = ASCII), and the use of
GetPropertyItem and SetPropertyItem based on the remarks here:
http://msdn.microsoft.com/en-us/library/system.drawing.image.setprop
ertyitem.aspx

        ' put the new description into the right property item
        objPropertyItem = Pic.GetPropertyItem(272)
        With objPropertyItem
            .Id = 36867
            .Type = 2
            .Len = 20
            .Value = bDescription
        End With
        Pic.SetPropertyItem(objPropertyItem)

Anyway, I'd kept the images and traces from my test on 25th August
and tested in JOSM and once I'd set the offset to +1 to sync clock
they were all positioned perfectly. I can now double check that I
remembered correctly where each was taken when I was doing the
tagging that day; I'd had to rely on memory rather than seeing them
in JOSM, and that isn't always the best...

I've sufficient memory in my phone for plenty of these low res
images, and I can recharge the phone easily. 

Ed

PS: I don't know whether the full VB code is of any use to anyone,
but if anybody does want it let me know.






More information about the Talk-GB mailing list