I have problems to record the GPS data in a file.
I use the following code:
Code: Select all
var
  mLoadOption: TGFL_LOAD_PARAMS;
  mSaveOption: TGFL_SAVE_PARAMS;
  mOriBitmap: PGFL_BITMAP;
  mEXIFData2 : PGFL_EXIF_DATAEX;
  mError : GFL_ERROR ;
  pq: array[0..5] of GFL_UINT32;
  LatitudeRef : string;
.....
begin
.....
    gflGetDefaultLoadParams(mLoadOption);
    mLoadOption.Flags := GFL_LOAD_READ_ALL_COMMENT;
    mLoadOption.Flags := GFL_LOAD_METADATA;
    mLoadOption.Flags := GFL_LOAD_COMMENT;
    mError := gflLoadBitmap(Pchar(FileName1),mOriBitmap, mLoadOption, lInformation);
    mEXIFData2 := gflBitmapGetEXIF2(mOriBitmap);
    LatitudeRef := 'N';
    gflBitmapSetEXIFValueString2(mEXIFData2, GFL_EXIF_GPS_IFD, 1,PChar(LatitudeRef));
    pq[0] := 28;  pq[1] := 1;
    pq[2] := 26;  pq[3] := 1;
    pq[4] := 119; pq[5] := 2;
    Count := 3;
    gflBitmapSetEXIFValueRationalArray2(mEXIFData2,GFL_EXIF_GPS_IFD,2,@pq,count);
    gflBitmapRemoveMetaData(mOriBitmap);
    gflBitmapSetEXIF2(mOriBitmap,mEXIFData2);
    gflGetDefaultSaveParams(mSaveOption);
    mSaveOption.Flags := GFL_SAVE_REPLACE_EXTENSION;
    mSaveOption.Flags := GFL_SAVE_ICC_PROFILE;
    mSaveOption.FormatIndex := 0;
    mSaveOption.Quality := 50;
    gflSaveBitmap(PChar('prueba.jpg'),mOriBitmap,mSaveOption);
    gflFreeFileInformation(lInformation);
    gflFreeBitmap(mOriBitmap);
    gflFreeEXIF2(mEXIFData2);
...
end;
If I remove the code mLoadOption.Flags := GFL_LOAD_COMMENT;, the files that do not contain data EXIF originally are stored the information correctly, but files containing EXIF data originally are stored incorrectly. In this case:
Latitude: 28/1º 26/1' 59.50"
This does not happen if the original file contains GPS data. In this case, the information is recorded correctly.
If image resolution data are recorded , the same:
Code: Select all
....
//Resolution
    gflBitmapSetEXIFValueRational2(mEXIFData2, GFL_EXIF_MAIN_IFD, 282, 200, 1);     // For 200 dpi
    gflBitmapSetEXIFValueRational2(mEXIFData2, GFL_EXIF_MAIN_IFD, 283, 200, 1);     // For 200 dpi
....
yResolution: -56/1
What is the problem?
Miguel Angel