bitmap - How do I get string representation of jpeg EXIF tags in c#? -
Using bitmap class, you can enumerate and edit EXIF tags, there are lots of examples.
one:
bitmap bjpgWithExifData = (bitmap) Image.FromFile (@ "myfile.jpg"); Foreign currency (var items in bjpgWithExifData.PropertyItems) {Console.WriteLine ("{0} \ t {1} \ t {2}", item type, item.Id, item.Len); }
However, it does not explain how I get the string value of those tags. The data is binary, and when I try to decode it with the encoding .ASCII.GetString (item.Value)
, I get some junk instead of the appropriate properties.
How do I get string values?
UPDATE
Aksaif shown by JPIFSnoop tag here:
EXIF IFD0 @ absolute 0x00000014 Dir length = 0x0010 [model] = "GT-I9500" [orientation] = row 0: top, Colonel 0: left [White Balance] = Auto White Balance [Dettaim] = "2014: 07: 30 13:24:28" # "[make] =" Samsung "[Aksaifofset] = @ 0x010 Sifrf offset IFD = 0x00000000
to when enumerate C # properties, I have 18 different looks for different qualities I am, of which 2 types 2 ("
UPDATE 1
strong>H before I was used to print the values of code:
foreach (var item) {Console in bjpgWithExifData.PropertyItems. WriteLine ("{0} \ t0x {1} \ t {2} \ t {3} \ t {4}", item.Type, item.Id.ToString ("x"), item.Len, Convert.ToBase64String (Item.Value), Encoding.ASCII.GetString (item.Value))}
And here's the output:
3xx100 2 IBA => 0x101 2 Egk = | 2 0x10f 8 U0FNU1VORwA = SAMSUNG 3 0x112 2 AQA = O 2 0x132 20 MjAxNDowNzozMCAxMzoyNDoyOAA = 2014: 07: 30 13:24:28 10 0x829a 8 PgAAAOgDAAA = & gt; ? | 10 0x829d 8 FgAAAAoAAAA = - 4 0x201 4 KgEAAA == * O 4 0x202 4 AAAAAA == 3 0x8822 2 Aga = O 3 0x8827 2 MGA = 2 3 0x9207 2 Aga = O 3 0x9208 2 AAA = 3 0x9209 2 AQA = O 5 0x920a 8 pAEAAGQAAAA =? It d3 0xa403 2AAA = 3 0x5091128 BwAHAAoAEwAoACgAKAAoAAcACAAKABoAKAAoACgAKAAKAAoAFgAoACgAKAAoACgAEwAaACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAAAACgAKAAoACgAKAAoACgAKAA =! (((((((((((((And (((((((((((((and ((((((((((((((((( ((((((3 0x5090 128 BgAEAAQABgAKABAAFAAYAAUABQAGAAgACgAXABgAFgAGAAUABgAKABAAFwAcABYABgAHAAkADAAUACMAIAAZAAcACQAPABYAGwAsACkAHwAKAA4AFgAaACAAKgAtACUAFAAaAB8AIwApADAAMAAoAB0AJQAmACcALQAoACkAKAA = | | | | & gt; ¶ ^ | | | ^ - | | | & gt; | l - | + ¶ # v 0 - & lt ;,) Ў d - & Gt; * -% ¶ & gt; Ў #) 0 - (-% & amp; - - () (
Check this library on the code project:
Comments
Post a Comment