Board index » delphi » How to load a jpeg file to TImage ??

How to load a jpeg file to TImage ??

I tried to use Image1.Picture.LoadFromFile to load the jpeg file in Delphi 4
but it doesn't work.  The compiler tells me that it is invalid file.  But I
really load that Delphi 4 support jpeg since I can load a jpeg file from the
load Properties in Object Inspector.  Why ??  How can I do it dynamically ??
Thanks in advance.

Andrew

 

Re:How to load a jpeg file to TImage ??


You must add the jpeg unit to your 'Uses' clause:

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, Buttons, jpeg;

Quote
Andrew Zerone wrote:
> I tried to use Image1.Picture.LoadFromFile to load the jpeg file in Delphi 4
> but it doesn't work.  The compiler tells me that it is invalid file.  But I
> really load that Delphi 4 support jpeg since I can load a jpeg file from the
> load Properties in Object Inspector.  Why ??  How can I do it dynamically ??
> Thanks in advance.

> Andrew

--
Harm  (remove thebaragain for email)

"Two major products came out of Berkely in the 70's;
Unix and LSD.  It's not a coincidence."

Other Threads