I am currently working on Delphi XE2 trial version. I want to load and display TIFF images in TImage control without using any third party component/library.
I tried below code but it is not woking for me.
Procedure TForm1.Button1Click(Sender: TObject);
Var
OleGraphic : TOleGraphic;
fs : TFileStream;
Source : TImage;
BMP : TBitmap;
Begin
Try
OleGraphic := TOleGraphic.Create;
fs := TFileStream.Create('c:\testtiff.dat', fmOpenRead Or fmSharedenyNone);
OleGraphic.LoadFromStream(fs);
Source := Timage.Create(Nil);
Source.Picture.Assign(OleGraphic);
BMP := TBitmap.Create;
bmp.Width := Source.Picture.Width;
bmp.Height := source.Picture.Height;
bmp.Canvas.Draw(0, 0, source.Picture.Graphic);
image1.Picture.Bitmap := bmp;
Finally
fs.Free;
OleGraphic.Free;
Source.Free;
bmp.Free;
End;
End;
Please advice.
tiff := TWICImage.Create;
tiff.LoadFromFile(Filename);
ABitmap.Assign(tiff);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With