Rank: Member
Groups: Guest
Joined: 11/14/2006(UTC) Posts: 1
|
am trying to figue out how to set the ExifDictionary.UserComment field. I tried Code:JpegReader jpegReader = (JpegReader) formatReader;
ExifDictionary exifData = jpegReader.Exif;
exifData[ ExifDictionary.UserComment ] = "blah blah";
but this fails. any ideas? thanks! port119 Edited by user Tuesday, December 18, 2007 8:13:52 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, This tag contains byte buffer which can include different types of information: ASCII, JIS, Unicode and undefibed. This information can be obtained from EXIF specification. Here is sample code which writes ASCII string in this tag: Code:string comment = "blah blah";
System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
// Byte buffer. This buffer contains string with 8 byte prefix, which includes information type.
byte[] array = new byte[comment.Length + 8];
array[7] = 2; // ASCII flag
encoder.GetBytes(comment).CopyTo(array, 8);
Aurigma.GraphicsMill.Codecs.JpegReader jpegReader = new Aurigma.GraphicsMill.Codecs.JpegReader(@"d:/temp/xmp/xmp1.jpg");
Aurigma.GraphicsMill.Codecs.JpegWriter writer = new Aurigma.GraphicsMill.Codecs.JpegWriter(@"d:/temp/UserComment.jpg");
// Write destination Jpeg.
Aurigma.GraphicsMill.Codecs.ExifDictionary exifData = jpegReader.Exif;
exifData[Aurigma.GraphicsMill.Codecs.ExifDictionary.UserComment] = array;
writer.Exif = exifData;
writer.AddFrame(jpegReader.LoadFrame(0));
writer.Close();
jpegReader .Close();
Edited by user Tuesday, December 18, 2007 8:16:33 PM(UTC)
| Reason: Not specified |
|
|
|
|
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.