Author |
Topic  |
|
Patrick Quinn
 
United Kingdom
81 Posts |
Posted - Jul 22 2011 : 14:03:33
|
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
|
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 |
 |
|
Patrick Quinn
 
United Kingdom
81 Posts |
Posted - Jul 23 2011 : 07:35:49
|
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 |
 |
|
Patrick Quinn
 
United Kingdom
81 Posts |
Posted - Jul 23 2011 : 07:38:11
|
Apologies Thank you, Nigel, for your quick reponse.
regards
Patrick |
 |
|
xequte
    
39106 Posts |
|
Patrick Quinn
 
United Kingdom
81 Posts |
Posted - Jul 24 2011 : 06:06:54
|
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 |
 |
|
xequte
    
39106 Posts |
|
Patrick Quinn
 
United Kingdom
81 Posts |
Posted - Jul 26 2011 : 00:35:50
|
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 |
 |
|
xequte
    
39106 Posts |
|
Patrick Quinn
 
United Kingdom
81 Posts |
|
User
3 Posts |
Posted - Jul 29 2011 : 02:41:15
|
Line 340: EXIF_COMPATIBLE_EXTENSIONS='*.TIF;*.TIFF;*.JPE;*.JPG;*.JPEG;'+_RAW_CAMERA_FORMATS;
What about PSD?
|
 |
|
fab
   
1310 Posts |
Posted - Jul 29 2011 : 07:11:19
|
ImageEn cannot read EXIF from (or write to) PSD files. |
 |
|
Murat
 
Russia
48 Posts |
Posted - May 15 2012 : 02:14:15
|
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 |
 |
|
xequte
    
39106 Posts |
|
|
Topic  |
|