AndyJim
asked on
Animated .gif in VB4
I have an animated .gif that is a blinking eye (one image open, one closed). I want to display this in VB4 16 bit (or 32 bit available at a pinch). How can I display the .gif so that the eye blinks? So far I have converted the .gif to a .bmp, but the eye is stuck open, i.e. on the first image.
ASKER
I need to know how to split the eye into its component images. So far I have opened the .gif in microsoft internet explorer, from which I saved it as a .bmp - how do I split it into separate jpg or bmp files?
ASKER
I need to reopen this because I've got to get the eye blinking at all costs!
You'll have to use a program to extract the seperate bitmaps. I would suggest going to www.download.com and searching for something like +gif and looking through the results to find a promising program. You can use it once and uninstall it if you like. Extract the images using it and then do what the first person said.
RecilS is correct. The program that I found that is the best and easiest to do this (extract an animated .gif into it's respective frames or images) is Animation Shop from Jasc inc. at www.jasc.com. This will let you select the images in the animated .gif file individually then save them as single bitmaps or whatever. You will then have to do what the other person suggested to get them to display individually when you want them...
Good Luck,
Cantrell
Good Luck,
Cantrell
Heh, go figure. I write code for 30 minutes for Andy, and RecilS comes by, states www.download.com and gets points. Sounds like my job.
I know it it can be verry important to have such a -eye blinking- thing in you app.
I'll help you. Send your gif to perfect_inmate@hotmail.com
and i'll show you.
I'll help you. Send your gif to perfect_inmate@hotmail.com
and i'll show you.
ASKER
not enough inf.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Delay, sorry. Busy, busy,busy. Back soon!
There is a free anigif control at:
http://www.pncl.co.uk/~sbutler/ocx/gif89.zip
only it does not work on all gifs.
Try it. It could save you a lot of hassles.
http://www.pncl.co.uk/~sbutler/ocx/gif89.zip
only it does not work on all gifs.
Try it. It could save you a lot of hassles.
.
Cut the GIF into it's frames (you said it has 2 frames, one w/ eye open, one w/ eye closed). Save each frame as it's own file (i.e. Frame one would be eye1.jpg and Frame two would be eye2.jpg). Now, add an Image to your VB form. Call it Image1 for now. Ok, now make the image link to the first frame. Let's say that we saved it in the root c:\ directory. So, the image is going to be linked to "C:\eye1.jpg", right? Now, to loop it infinitely, do this:
Add a Timer component to your form. Name it Timer1 and Disable it (enabled = false). Set it's interval to 1 second. Now, here's what the Sub for the timer is going to look like:
Private Sub Timer1_Timer
Dim Frame As Integer
If (Frame < 1) OR (Frame > 2) Then Frame = 1
If Frame = 1 Then
Image1.Picture = "C:\eye2.jpg"
Frame = 2
Elseif Frame = 2 Then
Image1.Picture = "C:\eye1.jpg"
Frame = 1
End if
Now, what will this do? Every 1 second it will check to see what the value of the variable Frame is. If the current Frame is #1, then it's going to want to load Frame 2 (C:\eye2.jpg) and it will want to change the value of Frame to 2 since it is now on the 2nd frame. Now, on the 2nd frame, it's going to want to do the opposite and change the picture to Frame 1 (C:\eye1.jpg) and tell the Frame variable that it is now 1 since it's now the 1st frame.
Now, key things to know. First, in your Form Load section you will want to add a line:
Timer1.Enabled = True
This will turn the animation ON. And, also, let's say that someone clicks a button to move to a new form. You will want to add the line:
Timer1.Enabled = False
In the OnClick portion. That way, it will turn the animation OFF.