I'm currently writing and reading Exif codes without problems using GdPictureImaging.
However I need to write a number into the TagExifUserComment field (don't ask why, customer request).
The number is written but using any Exif viewer (Opanda, Irfanview...) the value found is "UNICODE ASCII <number>" and the type of the field is "UNDEFINED".
if I do the same in a field like "tagArtist" I don't have this result, it seems to be something related to TagExifUserComment only. Lucky me, that's the field I need.
I'm writing the exif code using a line like:
TagSetValueString(imgID, GdPicture.Tags.TagExifUserComment, TagType.TagTypeASCII, number.ToString());
This strange behaviour causes a problem, since the other applications I'm interfacing with tries to read a string ans parse it as a number.
Well, everything seems right!
The TIFF Tag UserComment should be of the type UNDEFINED and containing 8 first bytes defining the encoding. And GdPicture correctly do that.
From the specs:
If you attach an example of your image I will confirm you if there any ano possible issue or not.IFD Exif
Code 37510 (hex 0x9286)
The specification defines these possible values for the first 8 bytes of the tag data:
ASCII (hex 41, 53, 43, 49, 49, 00, 00, 00): ITU-T T.50 IA5
JIS (hex 4A, 49, 53, 00, 00, 00, 00, 00): JIS X208-1990
Unicode (hex 55, 4E, 49, 43, 4F, 44, 45, 00): Unicode Standard
Undefined (hex 00, 00, 00, 00, 00, 00, 00, 00): Undefined
Perhaps I'm doing something wrong, but if I try to set the tag as TagType.TagTypeUndefined, no value is saved at all.
But if I use a TagType.TagTypeASCII I see, in the resulting hex, this prefix: "UNICODE ASCII".
So, not only UNICODE or ASCII, but both of them.
Could you explain further how you process to get this result?But if I use a TagType.TagTypeASCII I see, in the resulting hex, this prefix: "UNICODE ASCII"
Could you also attach an image with such data?
Code: Select all
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); byte bytes = enc.GetBytes(value); gdi.TagSetValueBytes(imgId, Tags.TagExifUserComment, TagType.TagTypeASCII, bytes);
That said, as I asked before I really need a produced image from your side to advice more.
In case you want to use the TagSetValueBytes, you have to provide an array of bytes that meet the specs, meaning with the 8 bytes of header.
Who is online
Users browsing this forum: Baidu [Spider] and 4 guests