c# - Get ImageUniqueID in .tiff images -


with following code-snippet uniqueimageid of .jpg image. same code doesn't work .tiff files. has idea? thx

image myimage = new bitmap(@"c:\path\to\picture.tiff"); system.text.asciiencoding encoding = new system.text.asciiencoding(); propertyitem pi = myimage.getpropertyitem(42016);   // exif-code -> uniqueimageid string uniqueimageid = encoding.getstring(pi.value, 0, 32); 

my solution:

string uniqueimageid; tiff mytiff = tiff.open(absolutepath, "r"); fieldvalue[] exififdtag = mytiff.getfield(tifftag.exififd); int exififdoffset = exififdtag[0].toint(); mytiff.readexifdirectory(exififdoffset); fieldvalue[] value = mytiff.getfield(tifftag.exif_imageuniqueid); if (value != null) {     (int = 0; < value.length; i++)     {         uniqueimageid = value[i].tostring();     }  } mytiff.close(); 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -