Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
mike_w_mason  
#1 Posted : Thursday, July 9, 2009 8:59:18 PM(UTC)
mike_w_mason

Rank: Newbie

Groups: Member
Joined: 4/27/2009(UTC)
Posts: 3

I am trying to update the EXIF GPS data for a series of jpg images but am getting an error in Visual Studio when trying to access the ExifDictionary using []. My code is copied directly from the sample in the on-line help:

1. using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(imageFullPath)) {
2. using (Aurigma.GraphicsMill.Codecs.JpegWriter writer = new Aurigma.GraphicsMill.Codecs.JpegWriter(imageFullPath)) {
3. Aurigma.GraphicsMill.Codecs.ExifDictionary exif = new Aurigma.GraphicsMill.Codecs.ExifDictionary();
4. exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.GpsLatitude] = latitudeAsExifString;
5. writer.Exif = exif;
}
}


I get the following error on line 4:
Error 1 Cannot apply indexing with [] to an expression of type 'Aurigma.GraphicsMill.Codecs.ExifDictionary' C:\Users\Mike Mason\Documents\My Dropbox\Development\KMLMerge\KMLMerge\Form1.cs 42 13 KMLMerge[/size]

and another error on line 5:
Error 2 'Aurigma.GraphicsMill.Codecs.JpegWriter' does not contain a definition for 'Exif' and no extension method 'Exif' accepting a first argument of type 'Aurigma.GraphicsMill.Codecs.JpegWriter' could be found (are you missing a using directive or an assembly reference?) C:\Users\Mike Mason\Documents\My Dropbox\Development\KMLMerge\KMLMerge\Form1.cs 43 15 KMLMerge



I suspect it is my lack of C# experience coming into play here but as the code is pretty much a copy of the on-line help perhaps it is something else.

Any help would be appreciated,

Mike

Using VS2008, and Graphics Mill 5.1




Tamila  
#2 Posted : Sunday, July 12, 2009 6:09:08 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hello Mike,

The following code demonstrates how to use Exif metadata, try to use this method:
Code:
using (Aurigma.GraphicsMill.Codecs.JpegReader reader = new Aurigma.GraphicsMill.Codecs.JpegReader("fileName.jpg"))
using (Aurigma.GraphicsMill.Codecs.JpegFrame frame = (Aurigma.GraphicsMill.Codecs.JpegFrame)reader.LoadFrame(0))
using (Aurigma.GraphicsMill.Codecs.JpegWriter writer = new Aurigma.GraphicsMill.Codecs.JpegWriter("newFileName.jpg"))
{
	Aurigma.GraphicsMill.Codecs.ExifDictionary exif = new Aurigma.GraphicsMill.Codecs.ExifDictionary();

	object[] latitude = new object[3];
	latitude[0] = new Aurigma.GraphicsMill.UnsignedRational(1, 2);
	latitude[1] = new Aurigma.GraphicsMill.UnsignedRational(1, 2);
	latitude[2] = new Aurigma.GraphicsMill.UnsignedRational(1, 2);
	exif.SetItemArray(Aurigma.GraphicsMill.Codecs.ExifDictionary.GpsLatitude, latitude);
	exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.GpsLatitudeRef] = "N";

	writer.Exif = exif;
	writer.AddFrame(frame);
}

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
mike_w_mason  
#3 Posted : Tuesday, July 14, 2009 8:36:18 PM(UTC)
mike_w_mason

Rank: Newbie

Groups: Member
Joined: 4/27/2009(UTC)
Posts: 3

Thanks Tamila for your response. Unfortunately when using your code example I still get an error at the line:

exif[Aurigma.GraphicsMill.Codecs.ExifDictionary.GpsLatitudeRef] = "N";

Error message is:
Error 1 Cannot apply indexing with [] to an expression of type 'Aurigma.GraphicsMill.Codecs.ExifDictionary'

and the line:
writer.Exif = exif;

Gives the following message:
Error 2 'Aurigma.GraphicsMill.Codecs.JpegWriter' does not contain a definition for 'Exif' and no extension method 'Exif' accepting a first argument of type 'Aurigma.GraphicsMill.Codecs.JpegWriter' could be found (are you missing a using directive or an assembly reference?)

I am sure there must be something I am doing wrong but cannot see it,

Thanks

Mike
Tamila  
#4 Posted : Wednesday, July 15, 2009 5:17:09 PM(UTC)
Tamila

Rank: Advanced Member

Groups: Member
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Hello Mike,

It is a very strange behavior. Try to compile sample project (see attachment) on your machine.
Also I recommend you to use the latest version Graphics Mill 5.1.277. You can download it here:
http://aurigma.com/Produ...illdotNET/FreeTrial.aspx

If you still have any problems please send us your sample application where we can reproduce your problem, any additional information will be helpful. If you do not want to post your application here you can submit support case
File Attachment(s):
SampleProject.zip (2,375kb) downloaded 4 time(s).
Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.