2005.02.28 11:51 "[Tiff] Delphi TIFF visualization", by José María Núñez Ortuño

2005.02.28 12:48 "Re: [Tiff] Delphi TIFF visualization", by Joris Van Damme

Oh, and, like I said, going from what I posted before to display in a TImage component is simply a matter of assigning the TBitmap to the TImage.Picture property. Note that this does not transfer ownership of the TBitmap, but increments usage counters in a copy-on-write scheme (which can be though of as being the same as making a copy, except that it doesn't require duplicate memory and duplication processing resources as long as you don't change either copy). So if you're not doing anything else with the TBitmap, you'll have to clean up the owned copy, which people tend to forget. Therefore, you code use the following example code for exactly 'to simply visualize a TIFF image in a Timage control using LibTiffDelphi', using normal Delphi exception raising/handling methods.

procedure TForm1.VisualizeTIFFFileInImage(Filename: String; Image: TImage);
var
  m: TBitmap;
begin
  try
    m:=ReadTiffIntoBitmap(Filename);
    Image.Picture.Assign(m);
    m.Destroy;
  except
    Image.Picture.Assign(nil);
  end;
end;

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html