Animated Gif89a format support

Posted on 1997-12-17
Medium Priority
Last Modified: 2012-05-04
I use VB 5.0 Enterprise Edition is there a way that I can read Gif89a files and display the additonal animated frames rather than just the first. If there is a way to do this can you point me to a source or give some sample code so that I can at least find a starting point.
Question by:Mikey121797
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1

Expert Comment

ID: 1445680
I don't have VB here right now to test this, but I used this approach with success. After having possibility to check it I'll get back, if there are problems with this.

1.  Add the WebBrowser object to your project (called Microsoft Internet Controls)
2.  Draw a WebBrowser control on your form
3.  In the Form_Load event, call WebBrowser1.Navigate:
        WebBrowser1.Navigate "c:\MyWeb\MyAnimation.gif"

Some things to consider:

 You have to have the gif as a file for the program to load; it can't be compiled into the program as eg. BMPs.

Since the picture is loaded at run time, you have to know the size of the gif when you draw the WebBrowser control.

Even withsome problems, it does give you the ability to display animated gifs (and other graphics formats).

Expert Comment

ID: 1445681
There also is a shareware OCX called anigif.ocx. I don't know it's availability at the moment, but check author's site at


Expert Comment

ID: 1445682
After having possibility to check my answer, I'd like to add following.

Ifyou do what I said with WebBrowser, you notice you got a 3-D look and vertical scroll bar, which you can't get rid of (at least I don't know a way). So as workaround I have done following.

Place a PictureBox on form, set it's looks to flat, no border and solid fill with your forms background color. Place the Webbrowser in this picturebox and make its Left = -30 and Top = -30 (if the scalemode of the picturebox is twips) and then adjust the picturebox's width and height properties so that you dont see WebBrowsers bottom and right borders.

I know this is tedious, but hey...it is free, if you have IE3 or better installed.

And that brings me to the final note. You can't distribute WebBrowser control, but you can always install IE on the target machine (clever marketing, MS)
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 1445683
I think the proposed answer (to put a WebBrowser Control on the Form) is much too oversized just to display a crippy GIF98a.

Remember that the WebBrowser Control uses about 4 MB of your main memory, needs to initialize the history and temporary internet files folder, etc. And the loading time of your app will reach new dimensions, that is for each instance of the 'GIF-Viewer' you instanciate (2 GIFs on form -> 5 Minutes wait ?? ;-))

Sorry, I just had to say that

Author Comment

ID: 1445684
Rantanen I tried what you suggested and it just isn't the solution I was looking for. I am looking to display an animated gif with complete control over the transprancy options and etc. D003303 is right the overhead is enormous. I was looking to read the animated Gif directly if possible not depend on an installation of internet explorer. If netcape & internet explorer can display animated gifs there certainly must be a way in VB code to do the same thing and BitBlt it somewhere??! If there is a free OCX somewhere that I don't have to pay for every distributed copy.
Well, I have spewed.

Expert Comment

ID: 1445685
Visual Basic doesn't support animated gifs; however, you can create the same affect.

Create a control array if images.  Assign the picture property of each image in the array to one of the graphics you wish to display in sequence to create the animation.  Make sure you set the top & left properties of all the images to the same value and make sure the pictures are all of the same size.   Use code to loop through the images (using a time delay in each iteration of the loop) making only one visible at time.

To create a continuously looping animation consisting of 5 images in a image control array indexed 0 to 4, put a timer control on your form and start it working in your code as follows:

   Timer1.Timer = 1000 (milliseconds  = 1 second)
   Timer1.Enabled = True

Turn it on or off with:

   Timer1.Enabled = True/False

Code in the Timer Event:

   Private Sub Timer1_Timer()
   Static i As Integer
   Const ImageCount = 5

      Image1(i).Visible = True
      Image1((i + ImageCount - 1) Mod 5).Visible = False
      i = (i + 1) Mod 5

   End Sub


Expert Comment

ID: 1445686
I agree with comments made, except the loading time...not too bad and it is the only free possibility I know . :-)

Mikey, did you check the availability of that OCX, last time I saw info about it was $30 and $40 w/source, not too bad.

mrmick, the only problem with your solution (which is a good way to do animation) is how do you get frames from GIF to the ImageList?

Expert Comment

ID: 1445687
One thing I forgot when talking about *free*. What is Compuserve's position these days? They have rights to that file format and at least earlier they tried to collect some royalties from everybody writing programs to manipulate GIF files.

I might be wrong, but it seems that the selection of free controls is very limited.

Accepted Solution

mrmick earned 800 total points
ID: 1445688
Hey Mikey,

I have not tried this one but you can get a free control to display animated gifs at the following site:


You can't do it using VB alone.  You will have to decode the file yourself or get a control (URL above) that will do it.  The method I provided as an answer yesterday shows how to display the gif once you've got it into an image control array (would also work with a picturebox control array).  There is a welth of info at the following site regarding Gif89a include the spec on how to read it.


Compuserve doesn't want royalties, just recognition unless their policy has changed in the last 2 years.


Author Comment

ID: 1445689
Thank's MrMick the Gif89a specifications are exactly what I needed to get started. AniGif still is not free but it seems to be a newer version than before. Increased Points to 200 enjoy! You deserve it! http://member.aol.com/royalef/gifabout.htm is a wonderfull sight!

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question