Board index » delphi » can't load jpg or gif images during runtime in TImage

can't load jpg or gif images during runtime in TImage

hello

i have a problem i just can load bitmap or icons in TImage
but no other ....graphic format
....i always get the error... unknown file extension
i use ..this to load
a TOpenDialog
a TImage
and a TButton
the button does this:
if OpenDialog.Execute then
  Image.Picture.LoadFromFile(OpenDialog.FileName);

...if you have an answer .....then.....thanks

 Rony

 

Re:can't load jpg or gif images during runtime in TImage


Quote
Messiah_of_Death wrote:

> hello

> i have a problem i just can load bitmap or icons in TImage
> but no other ....graphic format
> ....i always get the error... unknown file extension
> i use ..this to load
> a TOpenDialog
> a TImage
> and a TButton
> the button does this:
> if OpenDialog.Execute then
>   Image.Picture.LoadFromFile(OpenDialog.FileName);

> ...if you have an answer .....then.....thanks

>  Rony

include 'jpeg' in the uses statement to get jpeg-support.

joe

Re:can't load jpg or gif images during runtime in TImage


Quote
Messiah_of_Death <rony.liemmu...@base-system.net> wrote in message

news:3777DF58.5B56AC7B@base-system.net...

Quote
> i have a problem i just can load bitmap or icons in TImage
> but no other ....graphic format

If you have D3 or D4, you can just add a USES JPEG.

For GIF support, you'll need a GIF component, such as
Anders Melander's TGIFImage from
http://www.melander.dk/delphi/gifimage

Find info about Delphi Graphics File Formats and Conversions at
http://www.efg2.com/lab/libary/Delphi/Graphics/FileFormatsAndConversi...

efg
_________________________________
efg's Computer Lab:  http://www.efg2.com/lab
Delphi Books:  http://www.efg2.com/lab/TechBooks/Delphi.htm

Earl F. Glynn     E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

Re:can't load jpg or gif images during runtime in TImage


if you want to load a jpeg, when is the first time that you load a jpeg into
that image component, you need to create it.
for example:

var
    j:tjpegimage;
begin
    j:=tjpegimage.create;
    j.loadfromfile(<filename>):
    image1.picture.graphic:=j;
end;

Quote
Messiah_of_Death <rony.liemmu...@base-system.net> wrote in message

news:3777DF58.5B56AC7B@base-system.net...
Quote
> hello

> i have a problem i just can load bitmap or icons in TImage
> but no other ....graphic format
> ....i always get the error... unknown file extension
> i use ..this to load
> a TOpenDialog
> a TImage
> and a TButton
> the button does this:
> if OpenDialog.Execute then
>   Image.Picture.LoadFromFile(OpenDialog.FileName);

> ...if you have an answer .....then.....thanks

>  Rony

Re:can't load jpg or gif images during runtime in TImage


thanks......all works good
Quote
asel wrote:
> if you want to load a jpeg, when is the first time that you load a jpeg into
> that image component, you need to create it.
> for example:

> var
>     j:tjpegimage;
> begin
>     j:=tjpegimage.create;
>     j.loadfromfile(<filename>):
>     image1.picture.graphic:=j;
> end;

> Messiah_of_Death <rony.liemmu...@base-system.net> wrote in message
> news:3777DF58.5B56AC7B@base-system.net...
> > hello

> > i have a problem i just can load bitmap or icons in TImage
> > but no other ....graphic format
> > ....i always get the error... unknown file extension
> > i use ..this to load
> > a TOpenDialog
> > a TImage
> > and a TButton
> > the button does this:
> > if OpenDialog.Execute then
> >   Image.Picture.LoadFromFile(OpenDialog.FileName);

> > ...if you have an answer .....then.....thanks

> >  Rony

Other Threads