Subject Re: [IBO] use TIB_image with jpeg
Author Jay
> how to use TIB_image with jpeg?

According to TIB_Image's complaint on attempt to load a jpeg you will
need to convert your jpeg to bitmap, metafile or icon format. There are
samples in the delphi help files as to how to accomplish that. Though, I
have attached a working sample.

MyImage: TIB_Image; // created and freed elsewhere, perhaps as part of
a form

var
FileExt: string;
jpegImage: TJPEGImage;
tmpImage: TBitMap;

begin
with dlgLoadImage do
if Execute then begin
FileExt := LowerCase(ExtractFileExt(FileName));
// If it is a jpeg then we have to convert to bit image first!
if (FileExt = '.jpg') or (FileExt = '.jpeg') then begin
jpegImage := TJPEGImage.Create;
with jpegImage do begin
jpegImage.LoadFromFile(FileName);
tmpImage := TBitmap.Create;
with tmpImage do begin
Width := jpegImage.Width;
Height := jpegImage.Height;
Canvas.Draw(0, 0, jpegImage);
MyImage.Picture.Assign(tmpImage);
Free; // bitmap
end;
Free; // jpeg
end;
end
// load all other files permitted in the dlgLoadImage filter
MyImage.Picture.LoadFromFile(FileName);
end;
end;