Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Add GPS Location EXIF Metadata To JPEGs In Delphi XE5 Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey EXIF Image Data | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSIf you’re not using the built in CameraUI functionality on the Android and IOS devices you probably are not getting any EXIF metadata attached to your images on mobile devices. Luckily, an existing Delphi EXIF library was recently updated to add support for Delphi XE5 Firemonkey on Android and IOS. I’m not 100% sure on the IOS support because only an Android example was provided. In any event the CCR EXIF library will allow you to add GPS location data to the EXIF metadata of your JPEG images when you save them in Delphi XE5 Firemonkey. One caveat is that the CCR EXIF library requires the System.ByteStrings unit which you read about here. Chris Rolliston is the creator of the CCR EXIF library and he has a blog post about it here. He has has a sample app using the library up on Google Play. Here is some sample code from the project for setting the GPS location data:

uses
  CCR.Exif;

procedure SetSomeExifTags(const FileName: string);
var
  ExifData: TExifData;
begin
  ExifData := TExifData.Create;
  try
    ExifData.LoadFromGraphic(FileName);
    ExifData.Subject := 'Wimbledon Tennis';
    ExifData.SetKeyWords(['tennis', 'Wimbledon', 'match', 'SW19']);
    //Exif uses the degrees/minutes/seconds GPS format
    ExifData.GPSLatitude.Assign(51, 26, 1.48, ltNorth);
    ExifData.GPSLongitude.Assign(0, 12, 50.63, lnWest);
    ExifData.SaveToGraphic(FileName); 
  finally
    ExifData.Free;
  end;
end;


Check out and download the free CCR EXIF library plus examples.

Exit mobile version