Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy loading display of jpegs?

Status
Not open for further replies.

KempCGDR

Programmer
Jan 10, 2003
445
GB
Hi, I need an easy way to display jpegs in Delphi (no editing required, just displaying). I have tried just loading it into a TImage component, but it says the file has an unrecognised extension (bitmaps only I guess). So, is there a way to do inline conversion quickly, or a component that will do this? Otherwise I will have to distribute a few hundred megs of bitmaps with my app (not good). Thanks.
 
I've dug up the TJPEGImage documentation, but I don't get it at all, they nnever just do nice simple code snippets do they? Anyway, it looks like this lets you load jpegs into a TImage, so if anyone has used it, then that'd be great.
 
var
jpg:TJPEGImage;
begin
jpg:=TJPEGImage.Create;
jpg.LoadFromFile(FileName);
Image1.Picture.Assign(jpg);
jpg.Free;
end;
 
Thanks a lot, it seems so easy now. The helpfiles can give me whole topics on how to save a jpeg with all the different options, but not a simple four lines of code showing me how to display one. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top