Board index » delphi » Using GIF and JPG files in Delphi 3

Using GIF and JPG files in Delphi 3

I need a way to open GIF and jpeg files using the TImage component in
Delphi. I am trying to make a complete image viewer. Thank You!

 

Re:Using GIF and JPG files in Delphi 3


Quote
Vincenzo K. Marcovecchio wrote:

> I need a way to open GIF and jpeg files using the TImage component in
> Delphi. I am trying to make a complete image viewer. Thank You!

Hello Vincenzo,

Delphi 3 comes with JPEG support. You should link JPEG to your uses
clause. Then you can create an image with type TJPEGImage, load the JPEG
from a file and assign it to Image1.Picture.Bitmap. With a GIF image you
can do the same when you use for example the unit RxGIF from the
RXLibrary 2.40 what is downloadable from Torry's Delphi Pages
http://www.torry.ru/index.htm (it's freeware). There are some free
GIFImage components downloadable too.

Good luck!

Kerstin

Re:Using GIF and JPG files in Delphi 3


"Vincenzo K. Marcovecchio" <v...@colba.net> wrote:

Quote
>I need a way to open GIF and jpeg files using the TImage component in
>Delphi. I am trying to make a complete image viewer. Thank You!

The TJPEGImage that comes with Delphi 3 can handle the JPEG part for
you.

To display GIFs you can use something like my own TGIFImage or the one
that comes with RXlib. The one in RXlib doesn't display animated GIFs
in TImage though, but requires a separate component for that.

You can find my TGIFImage here:

  http://www.melander.dk/delphi/gifimage/

but since I will release a new version (2.0) some time during the next
24 hours, you should at least wait until the day after tomorrow before
you download anything.

Thank you for flying Air Melander.

+--------------------from usenet----------------------+
|  Anders Bo Melander    | Phone: (+45) 31 87 91 26   |
|  Finsensvej 79, 2. tv. | mailto:and...@melander.dk  |
|  DK-2000 Frederiksberg | http://www.melander.dk     |
|  Denmark               | flameto:bi...@microsoft.com|
+------------------------+----------------------------+

Re:Using GIF and JPG files in Delphi 3


Quote
Kerstin Thaler <muk.tha...@t-online.de> wrote:
>Delphi 3 comes with JPEG support. You should link JPEG to your uses
>clause. Then you can create an image with type TJPEGImage, load the JPEG
>from a file and assign it to Image1.Picture.Bitmap.

No need for that. TImage can determine the type of file from the file
extension.

uses
  jpeg, gifimage, .....;

...
  // Load a JPEG into a TImage component
  Image.Picture.LoadFromFile('myfile.jpeg');
  // Image.Picture.Graphic should now be a TJPEGImage
...
  // Load a GIF into a TImage component
  Image.Picture.LoadFromFile('myfile.gif');
  // Image.Picture.Graphic should now be a TGIFImage
...

Thank you for flying Air Melander.

+--------------------from usenet----------------------+
|  Anders Bo Melander    | Phone: (+45) 31 87 91 26   |
|  Finsensvej 79, 2. tv. | mailto:and...@melander.dk  |
|  DK-2000 Frederiksberg | http://www.melander.dk     |
|  Denmark               | flameto:bi...@microsoft.com|
+------------------------+----------------------------+

Re:Using GIF and JPG files in Delphi 3


Quote
Anders Melander wrote:

> Kerstin Thaler <muk.tha...@t-online.de> wrote:

> >Delphi 3 comes with JPEG support. You should link JPEG to your uses
> >clause. Then you can create an image with type TJPEGImage, load the
> JPEG
> >from a file and assign it to Image1.Picture.Bitmap.

> No need for that. TImage can determine the type of file from the file
> extension.

> uses
>   jpeg, gifimage, .....;

> ...
>   // Load a JPEG into a TImage component
>   Image.Picture.LoadFromFile('myfile.jpeg');
>   // Image.Picture.Graphic should now be a TJPEGImage
> ...
>   // Load a GIF into a TImage component
>   Image.Picture.LoadFromFile('myfile.gif');
>   // Image.Picture.Graphic should now be a TGIFImage
> ...

Thank you, Anders, you're right. If you install JPEG.pas with a package
you even can load .jpg and .jpeg files at designtime to TImage.

Regards

Kerstin

Other Threads