file - Read Exif GPS info using Delphi -
i need geolocation info photos. lat/lon , gpsversion. i've found info related question, compared different exif headers , found hexadecimal dump gives me coordinates - need file.
the question might seem simple. how open jpeg-file in delphi necessary hexadecimal dumps?
already tried read chars , integers, nothing worked. not use external libraries task if possible.
this major question, i'll extremely happy if answer 1 more.
is there easy way search gps tags without searching file specific dumps? i'm looking strange combination 12 00 02 00 07 00, works. i've read exif documentation couldn't understand thing gps tags.
thank in advance. eugene
if require no external libraries, can tfilestream , array of byte. i've done in project obtain 'picture taken date', gps lat-long coordinates field in exif header. don't have code here method straight-forward: once have tfilestream jpeg file:
- read first 2 bytes, check in fact $ff $d8 (just sure it's valid jpeg)
- read next 2 bytes, check if it's $ff $e1
- if it's not, depending on segment is, read 2 more bytes (or word) , skip bytes (by calling stream's seek method), there's list of segments here: https://en.wikipedia.org/wiki/jpeg#syntax_and_structure; repeat
- if is, read 4 bytes , see if it's 'exif' ($45 $78 $69 $66)
- what follows $00 $00 , 8-byte tiff header holds general information endianness, followed exif tags need work through , grab ones need, had quick search , found list here: http://www.exiv2.org/tags.html
since it's safe assume exif data in first kilobytes of jpeg file, read in byte array (or tmemorystream) , process data there, should perform better separate small reads tfilestream.
Comments
Post a Comment