tgif component

Delphi has a tjpeg component, but I want a tgif component. Preferably free.

I searched the web but couldn't find one (yet).

This component should be able to write  a TBitmap to a TStream.
ZwabbertAsked:
Who is Participating?
 
fulg0reConnect With a Mentor Commented:
the only best thing for GIF is TGIFImage from www.melander.dk
it is fullsource and got view/convert and other goodies.

enjoy
0
 
haehnenCommented:
0
 
RBertoraCommented:
or this:
gifimage.pas

http://208.201.252.100/pub/Source/GIF/index.htm

Rob ;-)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
RBertoraCommented:
A previous effor from Kretzschmar:

from my paq a gif <-> bmp <-> jpg converter
(using the freeware component gifimage)


      for better compatibility all pictures will transformed to 256 Colors,
      so you are able to convert
      true-color Bitmaps.

      unit pic_conv_u;

      interface

      uses
        Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
        ExtDlgs, ExtCtrls, StdCtrls,
        GifUnit,  //GifUnit used
        JPeg;     //JPeg Used

      type
        TForm1 = class(TForm)
          Panel1: TPanel;
          Button1: TButton;
          Button2: TButton;
          ScrollBox1: TScrollBox;
          Image1: TImage;
          OpenPictureDialog1: TOpenPictureDialog;
          SavePictureDialog1: TSavePictureDialog;
          procedure Button1Click(Sender: TObject);
          procedure Button2Click(Sender: TObject);
        private
          { Private-Deklarationen }
        public
          { Public-Deklarationen }
        end;

      var
        Form1: TForm1;

      implementation

      {$R *.DFM}

      procedure TForm1.Button1Click(Sender: TObject);
      var
        m : TMemoryStream;
        Suf : String[4];
        MyBmp : TBitmap;
        MyJPG : TJPegImage;
        MyGif : TGifFile;
      begin
        OpenPictureDialog1.Filter :=
          'PictureFiles (*.jpg;*.jpeg;*.gif;*.bmp)|*.jpg;*.jpeg;*.gif;*.bmp';
        OpenPictureDialog1.FilterIndex := 1;
        if OpenPictureDialog1.Execute then
        begin
          Suf := AnsiUpperCase(copy(ExtractFileExt(OpenPictureDialog1.Filename),2,4));
          Try
            if Suf = 'BMP' then
            begin
              MyBmp := TBitmap.Create;
              MyJPG := TJpegImage.Create;
              M := TMemoryStream.Create;
              try
                MyBmp.LoadFromFile(OpenPictureDialog1.Filename);
                MyJPG.Assign(MyBmp);
                MyJpg.SaveToStream(M);
                M.Position := 0;
                MyJpg.PixelFormat := jf8Bit;  //reduce colordepth to 8 Bit preventive
                MyJpg.LoadFromStream(M);      //Best result if done over JPG-Object
                Image1.Picture.Bitmap.Assign(MyJPG);
              finally
                MyBmp.Free;
                MyJpg.Free;
                M.Free;
              end;
            end
            else
              If Suf = 'GIF' then
              begin
                MyGif := TGifFile.Create;
                Try
                  MyGif.LoadFromFile(OpenPictureDialog1.Filename);
                  Image1.Picture.Bitmap.Assign(MyGif.AsBitmap);
                finally
                  MyGif.Free;
                end;
              end
              else
                If (Suf = 'JPG') or (Suf ='JPEG') then
                begin
                  MyJpg := TJpegImage.Create;
                  Try
                    MyJpg.LoadFromFile(OpenPictureDialog1.Filename);
                    MyJPg.PixelFormat := jf8Bit;  //Prepare 256 ColorDisplay preventive
                    Image1.Picture.Bitmap.Assign(MyJPG);
                  finally
                    MyJPG.Free;
                  end;
                end
                else Showmessage('Unknown FileFormat');
          except
            Showmessage('Error Opening '+OpenPictureDialog1.Filename);
            Image1.Picture.Assign(NIL);
          end;
        end;
      end;

      procedure TForm1.Button2Click(Sender: TObject);
      var
        Suf : String[4];
        MyBmp : TBitmap;
        MyJPG : TJPegImage;
        MyGif : TGifFile;
      begin
        SavePictureDialog1.Filter := 'Bitmap|*.bmp|GIF|*.gif|JPG|*.jpg';
        SavePictureDialog1.FilterIndex := 1;
        if SavePictureDialog1.Execute then
        begin
          Try
            Suf := AnsiUpperCase(ExtractFileExt(SavePictureDialog1.Filename));
            Case SavePictureDialog1.FilterIndex of
              1 : Begin  //Bitmap
                    if Suf <> '.BMP' then
                      SavePictureDialog1.Filename :=
                        SavePictureDialog1.Filename + '.BMP';
                    Image1.Picture.Bitmap.SaveToFile(SavePictureDialog1.Filename);
                  end;
              2 : Begin  // GIF
                    if Suf <> '.GIF' then
                      SavePictureDialog1.Filename :=
                        SavePictureDialog1.Filename + '.GIF';
                    MyGif := TGifFile.Create;
                    MyBmp := TBitMap.Create;
                    Try
                      MyBmp.Assign(Image1.Picture.BitMap);
                      MyGif.AddBitmap(MyBmp);
                      MyGif.SaveToFile(SavePictureDialog1.FileName);
                    finally
                      MyGif.Free;  //Bitmap will be freed here also
                    end;
                  end;
              3 : Begin
                    if Suf <> '.JPG' then
                      SavePictureDialog1.Filename :=
                        SavePictureDialog1.Filename + '.JPG';
                    MyJPG := TJpegImage.Create;
                    try
                      MyJPG.Assign(Image1.Picture.BitMap);
                      MyJPG.SaveToFile(SavePictureDialog1.Filename);
                    finally
                      MyJPG.Free;
                    end;
                  end;
            end;
          except
            Showmessage('Error Saving File '+SavePictureDialog1.Filename);
          end;
        end;
      end;

      end.

-- end converter
Rob ;-)
0
 
King_DavidCommented:
If you post your e-mail I'll send
you a unit that handles gif images and
annimated-gifs.

I don't remember where I found it.
0
 
kretzschmarCommented:
8^)
0
 
interCommented:
Hi,

I also recommend you to use the free components from RxLib at www.rxlib.com. The package is excelent.

regards,
igor
0
 
kretzschmarCommented:
0
 
kretzschmarCommented:
to fulgOre,

this q awaits your answer

http://www.experts-exchange.com/jsp/qShow.jsp?ta=delphi&qid=10227187 

meikl ;-)
0
 
RBertoraCommented:
FulgOre you should post as a comment.
Rob ;-)
0
 
ZwabbertAuthor Commented:
I tried most of the suggested sources.

And yours I got to work quickest with the best results.

Still thanks to all for the very useful links.

0
All Courses

From novice to tech pro — start learning today.