ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to check if EXIF has GPS data?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 22 2011 :  14:03:33  Show Profile  Reply
I need a way of checking if an image's EXIF data contains GPS data.
A boolean property like TIOParams.EXIF_HasEXIFData would be ideal. (A new property called TIOParams.EXIF_GPSHasGPSData perhaps?).

Is there an easy way of doing this?

As a workround I am checking that (EXIF_GPSLatitudeDegrees > 0) and (EXIF_GPSLongditudeDegrees > 0). This works but is a bit crude.

Thank you for an excellent product

regards

Patrick

xequte

39106 Posts

Posted - Jul 22 2011 :  22:48:30  Show Profile  Reply
Hi Patrick

I have a unit to handle all my EXIF tasks. Here are the relevant GPS ones:


function DegreesMinutesSecondsToDecimal(dDeg, dMin, dSec: Double): Extended;
begin
  Result := dDeg + (dMin / 60) + (dSec / 3600);
end;


function GPSAsDecimal(const dGPSDegrees, dGPSMinutes, dGPSSeconds: Double; const sGPSReference: string): Extended;
begin
  Result := DegreesMinutesSecondsToDecimal(dGPSDegrees, dGPSMinutes, dGPSSeconds);

  if SameText(RemoveNull(sGPSReference), 'S') or
     SameText(RemoveNull(sGPSReference), 'W') then
    Result := -1 * Result;
end;

function GPSLatitudeDecimal(AParams: TIOParams): Extended;
begin
  with AParams do
    Result := GPSAsDecimal(EXIF_GPSLatitudeDegrees, EXIF_GPSLatitudeMinutes, EXIF_GPSLatitudeSeconds, EXIF_GPSLatitudeRef);
end;

function GPSLongitudeDecimal(AParams: TIOParams): Extended;
begin
  with AParams do
    Result := GPSAsDecimal(EXIF_GPSLongitudeDegrees, EXIF_GPSLongitudeMinutes, EXIF_GPSLongitudeSeconds, EXIF_GPSLongitudeRef);
end;



function HasExifGPSData(AParams: TIOParams): Extended;
begin
  Result := (GPSLatitudeDecimal(AParams) <> 0) or
            (GPSLongitudeDecimal(AParams) <> 0)
end;



// return the GPS fields from the exif fields
function ExifGPSData(sFilename: string;
                     AnImageEnIO:TImageENIO;
                     out xGPSLatitudeDegrees: Extended;
                     out xGPSLongitudeDegrees: Extended
                     ): Boolean;
begin
  result := False;
  xGPSLatitudeDegrees  := 0;
  xGPSLongitudeDegrees := 0;

  if IsJPEG(sFilename, TRUE) then
  try
      // use get params from file to fill the _ImageEnIO with the EXIF data
    AnImageEnIO.paramsfromfile(sFilename);

    if AnImageEnIO.params.EXIF_HasEXIFData then
    begin
      xGPSLatitudeDegrees  := GPSLatitudeDecimal(AnImageEnIO.Params);
      xGPSLongitudeDegrees := GPSLongitudeDecimal(AnImageEnIO.Params);
    end;

    Result := (xGPSLatitudeDegrees <> 0) or (xGPSLongitudeDegrees <> 0);

  except
    // ERROR
  end;
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 23 2011 :  07:35:49  Show Profile  Reply
Thank you, xequte, for your quick reponse. That is just what I need.

I have a unit to handle all my EXIF tasks.
Any possibility of putting this in the downloads section?

regards

Patrick
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 23 2011 :  07:38:11  Show Profile  Reply
Apologies
Thank you, Nigel, for your quick reponse.

regards

Patrick
Go to Top of Page

xequte

39106 Posts

Posted - Jul 24 2011 :  03:10:14  Show Profile  Reply
Hi Patrick

As requested you can download the unit from:

http://www.imageen.com/files/other/xieexifglobals.zip


The only other main function of use is the ability to read/write all EXIF fields of an image from/to a string grid.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 24 2011 :  06:06:54  Show Profile  Reply
Thanks, Nigel.

quote:
The only other main function of use is the ability to read/write all EXIF fields of an image from/to a string grid.

That's exactly what I am doing at the moment, your code will be useful.

regards

Patrick
Go to Top of Page

xequte

39106 Posts

Posted - Jul 25 2011 :  12:37:32  Show Profile  Reply
Thanks. I have a similar one for IPTC field support too.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 26 2011 :  00:35:50  Show Profile  Reply
quote:
Thanks. I have a similar one for IPTC field support too.


Hi Nigel.

I would greatly appreciate if I you could put this in the download section as well. Many of the IPTC fields look very useful.




regards

Patrick
Go to Top of Page

xequte

39106 Posts

Posted - Jul 27 2011 :  03:33:06  Show Profile  Reply
Hi Patrick

It is available at:

http://www.imageen.com/files/other/xieiptcglobals.zip



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Patrick Quinn

United Kingdom
81 Posts

Posted - Jul 27 2011 :  04:04:16  Show Profile  Reply
quote:
Hi Patrick

It is available at:

http://www.imageen.com/files/other/xieiptcglobals.zip


Thanks, Nigel

regards

Patrick
Go to Top of Page

User

3 Posts

Posted - Jul 29 2011 :  02:41:15  Show Profile  Reply
Line 340:
EXIF_COMPATIBLE_EXTENSIONS='*.TIF;*.TIFF;*.JPE;*.JPG;*.JPEG;'+_RAW_CAMERA_FORMATS;

What about PSD?
Go to Top of Page

fab

1310 Posts

Posted - Jul 29 2011 :  07:11:19  Show Profile  Reply
ImageEn cannot read EXIF from (or write to) PSD files.
Go to Top of Page

Murat

Russia
48 Posts

Posted - May 15 2012 :  02:14:15  Show Profile  Reply
Hi Fabrizio,

Does the latest ImageEN version support reading EXIF from PSD format?

If not, please remove the information on your Info page:
"Loading and saving of digital camera (EXIF) fields in JPEG, TIFF, RAW, PSD and HD Photo files (without modifying the original image)"

-
Murat
Go to Top of Page

xequte

39106 Posts

Posted - May 15 2012 :  19:51:19  Show Profile  Reply
Thanks Murat

We have updated the page.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: