Click here to Skip to main content
15,894,291 members

Comments by Member 10020245 (Top 7 by date)

Member 10020245 8-Sep-14 9:55am View    
The article here:
https://searchcode.com/codesearch/view/8739374/
provides a good illustration of using the InPlaceBitmapMetadataWriter to add new tags to pre-existing metadata from a jpg image.

The example uses the metadata class SetQuery(string query, Object value) command. The exact syntax used in the example is
metadata.SetQuery ( "/app1/ifd/{uint=897}", "hello there" );
I am not clear on the meaning of {uint=897}. I assume this defines the tag location that carries a definition of the type of metadata. In this case it would be an ASCII value.
Can someone show how this command would be modified if I want to add a GPS latitude tag? I am aware that the GPS latitude (and longitude) are comprised of 3 exif 8-byte Rational types or a byte array of 24 bytes.
Member 10020245 8-Sep-14 8:25am View    
kbrandwijk ...

I attempted to use the code you referenced.

My objective is to add new tags to am image's metadata and keep all the original metadata.
For example, add GPS position tags without modifying any of the original tags in the metadata.

Because the .net propertyItem object has no public constructor, I cannot see how to use your code to add new tags. You can modify existing tags, even changing an existing to represent a GPS tag type, but you cannot completely add new tags and leave all the old tags in place.

In the C# code you pointed out, the propertyItems were retrieved from an existing image, and you created a list of tags to be modified. If you wanted to add a tag that was not already there, it appears that you replace the propertyItem at location [0] with the new tag.

Is this correct?

Jim
Member 10020245 5-Sep-14 10:09am View    
The code I referenced above on the exiv2net site does not seem to work.
It can access and modify EXIF tags that already exist -- but doesnt seem to work for adding entirely new tags. The code that can be found below seems to explain the issue.
https://rwlodarcmsdnblog.svn.codeplex.com/svn/
This alternative code also uses the system.media namespace -- but offers that when adding new tags, the image must be read-in, copied, new metadata added, and then the image must be re-written.
Member 10020245 5-Sep-14 9:48am View    
kbrandwijk --

So sorry - no I have not actually tried the method you suggested. I should be able to do this today. However, I have been attempting to use the System.Windows.Media.Imaging namespace code here:
http://code.google.com/p/exiv2net/source/browse/trunk/example/MetaInfo.cs
from Andreas Grimme.
Also, this site:
http://www.i-programmer.info/programming/wpf-workings/588-bitmap-codingencoding-and-working-with-metadata.html?start=3
seems to suggest the WPF "inplacemetadatawriter" gets away with re-writing the entire image.

For my application, I take photos with a Canon with a pre-set EXIF structure, then I must add in the GPS tags to the existing image, and then store the tagged image to disk. I want to do this as fast as possible so that I can take images at a fast rate. The picture + download to disk alone takes 1.5 secs. If I have to access the image, copy it, and re-store the image, this may take too long. My thoughts are to compare the timing of both of the methods from the system.media and system.drawing namespaces.
--- Jim
Member 10020245 4-Sep-14 16:35pm View    
In the above Solution 1, there is a reference to "Kevin's work":
This blog gives an idea of adding/updating EXIF metadata of an image, and is based on the Kevin's work. The original post can be found here.

This link is broken. Do you have an updated link?
Else is the posed solution a standalone solution -- or do I need material from the link?