Loading...

Exif problem

Discussions about image processing in GdPicture.NET using GdPictureImaging.

Exif problem

Postby goldrian » Mon Jun 27, 2011 11:01 am

[C#, GdPicture.net 7]
No exif data is written into the image.... where is the problem?

Code: Select all
GdPictureImaging gdi = new GdPictureImaging();
gdi.SetLicenseNumber("XXXXXXXXXXXXXXXX");
string value = "testMaker";
int imgId = gdi.CreateGdPictureImageFromFile(@"C:\test.jpg");
string exifBefore = gdi.TagGetValueString(imgId, (int)GdPicture.Tags.TagExifMakerNote);
gdi.TagSetValueString(imgId, tag, TagType.TagTypeASCII, value);
string exifAfter =  gdi.TagGetValueString(imgId, (int)GdPicture.Tags.TagExifMakerNote);


Results:
exifBefore = ""
exifAfter = ""

Thanks.
goldrian
 
Posts: 7
Joined: Fri Jun 03, 2011 7:57 pm

Re: Exif problem

Postby Loïc » Mon Jun 27, 2011 11:34 am

Hi,

you are using wrong argument for the TagGetValueString method.

The second parameter expect a tag index (just have a look on the reference guide).
So you have to brows all existing tags, check for the tagname, and when the tag name is matched just return its value.

See here for an example related to the xmlpacket: gdpicture-dotnet-code-samples/extracting-xmp-metadata-image-xml-file-t1992.html

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4442
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Exif problem

Postby goldrian » Mon Jun 27, 2011 11:47 am

Thank you, now I understand ...
I did look at the reference guide but It wasn't enough for me :mrgreen:
Thanks again
goldrian
 
Posts: 7
Joined: Fri Jun 03, 2011 7:57 pm

Re: Exif problem

Postby Loïc » Mon Jun 27, 2011 11:51 am

You're welcome :)
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4442
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Exif problem

Postby goldrian » Mon Jun 27, 2011 12:20 pm

Ew....another problem... now that I correctly set the exif data, I see that, while in memory, the image contains all the tags, but when saved it lose them.
If I try to check the saved image reloading it or with an external exif reader program, it has no saved tags.
I've set a TagsSetPreserve(true), but no change.
Is there something else I'm missing from the reference guide? :(

PS: I'm saving using SaveAsJPEG(gdRef,filename, 100, true);
goldrian
 
Posts: 7
Joined: Fri Jun 03, 2011 7:57 pm

Re: Exif problem

Postby goldrian » Mon Jun 27, 2011 12:27 pm

Oh, well... If I save without "progressive" option it's ok!

SO:
SaveAsJPEG(gdRef,filename, 100, false); works

I don't know if that's a normal behaviour for "progressive" jpg , however I don't need them to be progressive, so that's a solution.
I leave this auto-answer here for others who can find the same problem :)
goldrian
 
Posts: 7
Joined: Fri Jun 03, 2011 7:57 pm


Return to Image Processing

Who is online

Users browsing this forum: No registered users and 2 guests