This is the code I use in Delphi 3. It may be different in later versions.
if ((SourceType = '.JPG') or (SourceType = '.JPEG')) then begin
JpegImage := TJpegImage.Create;
JpegImage.LoadFromFile(ImageFile);
SourceImage.Picture.Assign(JpegImage);
SourceImage is a TImage control. TJpegImage is part of the Delphi component
library (non VCL) that was added at version 3.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of John Christenhusz
> Sent: Wednesday, 31 January 2001 20:30
> To: Multiple recipients of list delphi
> Subject: [DUG]: TImage and JPG files
>
>
> G'day folks,
>
> I've got this TImage component showing images on request from a directory.
> This works file with *.BMP files, but don't seems to work with
> *.JPG files.
>
> The code I'm using is as follows:
>
> if fileExists(intToStr(iNumber) + '.JPG) then
> imgPhoto1.picture.loadFromFile(intToStr(iNumber) + '.JPG)
> else
> if fileExists(intToStr(iNumber) + '.BMP) then
> imgPhoto1.picture.loadFromFile(intToStr(iNumber) + '.BMP)
>
>
> Thus initially it searches for a JPG file else it loads a BMP file.
>
>
> The BMP file get loaded and shows correctly, but the JPG file returns the
> following message when loaded into the TImage:
> "Unknown picture file extension (.JPG)"
>
> Any idea?
>
> Thanks for your help.
>
> John Christenhusz
> E-mail: [EMAIL PROTECTED]
>
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"