Reading EXIF data

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias

Reading EXIF data

Post by madiazg »

Hello,
can you indicate me the way of obtaining and interpreting the EXIF data of an image?

I am using Turbo Delphi .

Regards...
User avatar
xnview
Author of XnView
Posts: 36291
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: EXIF

Post by xnview »

gflBitmapGetEXIF
Pierre.
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias

Post by madiazg »

Can you indicate any example to get exif data?
User avatar
xnview
Author of XnView
Posts: 36291
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post by xnview »

Code: Select all

	exif = gflBitmapGetEXIF(bitmap, 0); 
	if (exif)
	{
		for ( i=0; i<exif->NumberOfItems; i++)
			printf("EXIF %x %x <%s> = %s\n", exif->ItemsList[i].Flag, exif->ItemsList[i].Tag, exif->ItemsList[i].Name, exif->ItemsList[i].Value ); 
		gflFreeEXIF(exif); 
	}

Pierre.
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias

Delphi

Post by madiazg »

Can you tell me where is the mistake?

Code: Select all

var
  lp1b: TGFL_LOAD_PARAMS; 
  gfl_bmp1b: PGFL_BITMAP; 
  Pgfl_color1b: TGFL_COLOR;
  finfo1b: TGFL_FILE_INFORMATION;
  e1 : GFL_ERROR;
  Exif : PGFL_EXIF_DATA;
begin
    gflEnableLZW(GFL_TRUE); 
    gflGetDefaultLoadParams(lp1b);
    lp1b.ColorModel := GFL_BGR; 
    lp1b.LinePadding := 4; 

    gflLoadBitmap(Pchar(FileName1),gfl_bmp1b, lp1b, finfo1b); 

    e1 := gflBitMapHasEXIF(gfl_bmp1b);
    if gflBitMapHasEXIF(gfl_bmp1b) = gfl_no_error then
    begin
      LabelEXIF.Enabled := True;
      Exif := gflBitmapGetEXIF(gfl_bmp1b,0);
      Label1.Caption := IntToStr(Exif.NumberOfItems); //ERROR!!!!
      gflFreeEXIF(Exif);
    end else MessageDlg('File not readable: ' + string(gflGetErrorString(e1)), mtError, [mbOK], 0);
end;
User avatar
madiazg
Posts: 82
Joined: Wed Jul 18, 2007 8:00 pm
Location: Tenerife - Islas Canarias

Post by madiazg »

Hello, replacing the code

Code: Select all

EXIF := gflBitmapGetEXIF(gfl_bmp,0);
by that other

Code: Select all

Exif := gflLoadExif(Pchar(FileName),0);
It works well. There seems to be an error in (TurboDelphi)

Code: Select all

gflBitmapGetEXIF