How to read extended tags with LibTiffDelphi in Delphi 7

View: New views
1 Messages — Rating Filter:   Alert me  

How to read extended tags with LibTiffDelphi in Delphi 7

by Ivan Micetic :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I am trying to read extended tags from a tiff file in Delphi 7 and I
tried to implement it from a C code snippet found in the mailing list
but with no luck. I have tried something like the following but it has
errors:

...
const
  TIFFTAG_ASCIITAG=34682;
...
procedure TForm1.Button1Click(Sender: TObject);
var
  TestStr:string;
  xtiffFieldInfo:PTIFFFieldInfo;
  OpenTiff: PTIFF;

procedure TagExtender(Handle: PTIFF);
begin
  New(xtiffFieldInfo);
  xtiffFieldInfo^.FieldTag:=TIFFTAG_ASCIITAG;
  xtiffFieldInfo^.FieldReadCount:=-1;
  xtiffFieldInfo^.FieldWriteCount:=-1;
  xtiffFieldInfo^.FieldType:=TIFF_ASCII;
  xtiffFieldInfo^.FieldBit:=FIELD_CUSTOM;
  xtiffFieldInfo^.FieldOkToChange:=1;
  xtiffFieldInfo^.FieldPassCount:=0;
  xtiffFieldInfo^.FieldName:='MyTag';
  TIFFMergeFieldInfo(Handle,xtiffFieldInfo,1);
end;

begin
  TIFFSetTagExtender(@TagExtender);
  OpenTiff:=TIFFOpen('file.tif','r');
  TIFFGetField(OpenTiff,TIFFTAG_ASCIITAG,@TestStr);
  Label1.Caption:='>>>'+TestStr+'<<<';
end;

Could somebody let me know how to read/write an extended ascii and
other type of tags in Delphi?
Thank you in advance,

Ivan Micetic

_______________________________________________
Tiff mailing list: Tiff@...
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/