Working with GIF images in Delphi

Working with GIF,Even even though Delphi does not natively support GIF photo documents formats (like BMP or JPEG), there are some terrific (loose source) additives to be had on the Net, which upload the ability to show and control GIF snap shots at run as well as at design time to any Delphi application.

Natively, Delphi supports BMP, ICO, WMF and JPG photographs. These can be loaded right into a photographs-well suited issue (including TImage) and used in an application.

It’s essential to word that, as of Delphi model 2006, GIF format is supported by the VCL. To use lively GIF images you would nevertheless need a 3rd-party control.

GIFs–or Graphics Interchange Formats–are the most widely supported (bitmap) portraits format on the Web, both for nevertheless pix and for animations.

Working with GIF,Using in Delphi

Natively, Delphi (till version 2007) does no longer guide GIF snap shots, due to some criminal copyright problems. What this means, is that when you drop a TImage issue on a shape, use the Picture Editor (click on the ellipsis button inside the Value column for properties, which include the Picture property of TImage) to load an image into the TImage, you will no longer have an option to load GIF images.

Fortunately, there are a few 0.33-birthday party implementations on the Internet that provide full aid for the GIF layout:

  • TGIFImage: unfastened with supply (a model of Anders Melander’s TGIFImage ported to Delphi 7). Full TGraphic implementation of the GIF images layout. Reads, writes and presentations lively and transparent GIFs and might convert to and from any layout supported by using TGraphic (e.G TBitmap, TJPEGImage, TIcon, TMetaFile and many others.). Implements the whole GIF87a and GIF89a specification and most commonplace GIF extensions. Advanced functions consist of:
    • Integrates with TPicture to feature GIF support to the TImage, TOpenPictureDialog and TSavePictureDialog components. Also works at layout time.
    • Imports snap shots with more than 256 shades the usage of colour quantization and six exclusive dithering techniques (e.G. Floyd-​Steinberg).
    • Multi-threaded drawing engine.
    • GIF optimizer reduces the dimensions of your GIFs.
    • GIF to AVI and AVI to GIF converter.
  • GraphicEx image library: an addendum to Delphi’s Graphics.Pas to enable your software to load many not unusual photo codecs. This library is broadly speaking designed to load photographs as historical past (buttons, paperwork, toolbars) and textures (DirectX, OpenGL) or for photograph surfing and editing functions so long as you don’t want to store images. Currently, only TTargaGraphic additionally helps saving an image. GraphicEx is open source under the Mozilla Public License (MPL).

GIF,Using in Delphi

That’s approximately it. Now all you have to do is to down load one of the components and start using gif pix on your applications. You can, as an instance:

  • Store GIF photos in a database desk. You’ll want the GIF photo’s “magic numbers.”
  • Show GIF graphics as Glyph on a SpeedButton.
  • Store GIF pictures and an HTML record as a resource inner am exe.