[Lazarus] Is this the best way to add TIFF support to imgviewer?

Reinier Olislagers reinierolislagers at gmail.com
Thu Oct 18 11:28:47 CEST 2012


(repost from the forum, no response there, so trying my luck here)

Am trying to extend the Lazarus examples\imgviewer application with
.tiff support.

Is this[1] the best way to add tiff support to the Lazarus imageview
demo application?
It works but is a bit slow. Perhaps the slowness is caused by the tiff
reading routines themselves, my fairly large 5MB file or my way of coding.

Any suggestions to improve this?

Thanks,
Reinier



[1]
procedure TMainForm.ShowFile(Index: integer);
var
  TIFF: TTiffImage;
...
        // TImage does not support the TIFF format natively
        if
pos(LowerCase(ExtractFileExt(LBFiles.Items[Index])),'.tif.tiff')<>0 then
        begin
          TIFF:=TTiffImage.Create;
          try
            TIFF.LoadFromFile(LBFiles.Items[Index]);
            IMain.Picture.Bitmap.Assign(TIFF);
          finally
            TIFF.Free;
          end;
        end
        else
        begin
          // existing code




More information about the Lazarus mailing list