Tuesday, 15 April 2014

VB.NET Retrieving Meta Tags from an Image -



VB.NET Retrieving Meta Tags from an Image -

alright i've been messing few days now, , found topic here on board.

vb.net renaming file , retagging / edit image metadata / meta tags

after reading through that, , getting library 1 of answers spoke of, inserted code project , working decently well. entire reason looking such thing 'keywords/tags' metadata, , code no matter did wouldn't give me looking for.

knowing 'keywords' address &h9c9e able following.

dim test string = ex.getpropertystring(&h9c9e) msgbox(test)

that worked point, messed awhile no matter changed unable display anymore first character of tags. illustration placed 'test' in keywords , returned 't'. looked through coding of library, wasn't able figure out why wasn't returning everything. i've tried changing content in tags in effort @ getting load, , i've tried few different images though returned first character.

also when attempted create changes keywords data, unable display though next code worked else.

ex.setpropertystring(exifworks.tagnames.exifusercomment, "this worked") ex.getbitmap.save(saveloc + "1decfabd90e2355eac81b3f9735e10e3.jpg")

so question is, why displaying first character , why isn't able save address?

edit:

after playing bit able contents of 'keywords' appear, though isn't ideal.

dim test = ex.getproperty(&h9c9e) dim test2 = ex.encoding.getcharcount(test) dim test3 = ex.encoding.getchars(test) dim tolnum integer = test2 dim cur integer = -1 while tolnum > 0 cur = cur + 1 tolnum = tolnum - 1 msgbox(test3(cur)) end while

for illustration 'test' in 'keywords' 't;e;s;t;;;;' ; marking unknown characters/blank msgboxes.

alright help of grim i've been able right issue , find answer. solution used solve issue.

since 'keywords' field unicode had ensure when reading info field encoded unicode, , when saving needed ensure converted unicode before saving.

the code:

sub test() ''get saveloc settings dim saveloc string saveloc = my.settings.savelocation ''select photo edit/view dim bitmap string bitmap = saveloc + "\test\" + "1decfabd90e2355eac81b3f9735e10e3.jpg" ''use exifworks library dim ex new exifworks(bitmap) ''set encoding unicode dim enc new system.text.unicodeencoding ''get info keywords field dim keywords = ex.getproperty(&h9c9e) ''use unicode encoding contents within keywords dim decode = enc.getchars(keywords) ''view current tags, decoded unicode msgbox(decode) ''set encoding unicode dim enc2 encoding = encoding.unicode ''tags add together dim tags string = "these; are; testing; tags" ''encode unicode , switch bytes dim data() byte = enc2.getbytes(tags & vbnullchar) ''append keywords field new tags ex.setproperty(&h9c9e, data, exifworks.exifdatatypes.unsignedbyte) ''save changes ex.getbitmap.save(saveloc + "\test\" + "new1decfabd90e2355eac81b3f9735e10e3.jpg") end sub

vb.net image-processing metadata meta-tags

No comments:

Post a Comment