yyy Posted August 1, 2004 Share Posted August 1, 2004 Hi, I have a problem-my program uses an animated gif and that causes a rise in the CPU usage.Is there a way to minimize the rise of the CPU usage when using animated gifs? Link to comment Share on other sites More sharing options...
0 bithub Posted August 2, 2004 Share Posted August 2, 2004 You should start by posting what language you are using, and how you are using the gif. Link to comment Share on other sites More sharing options...
0 yyy Posted August 2, 2004 Author Share Posted August 2, 2004 (edited) Oh,your'e right :rolleyes: .I'm using c# (I'm a beginner so... :) ) and I'm doing the animation by changing the gif's frames and drawing them(sorry but I don't really know how to explain this) this way: Gifs.SelectActiveFrame(dimension,i); g.DrawImage(Gifs,x, 1,width, height); The "i" is the number of the frame which I change each time to make the animation.The problem is that drawing the image each time causes a rise in the CPU usage.Is there any way to reduce it? Edited August 2, 2004 by yyy Link to comment Share on other sites More sharing options...
0 bithub Posted August 2, 2004 Share Posted August 2, 2004 I've never used C#, so hopefully someone else here can lead you in the right direction. Link to comment Share on other sites More sharing options...
0 John Veteran Posted August 2, 2004 Veteran Share Posted August 2, 2004 What's your "Gifs" object, and what's g? :huh: It sounds like you're drawing the frames yourself, instead of using an actual animated gif, which would account for the high CPU usage... Title edited Link to comment Share on other sites More sharing options...
0 yyy Posted August 3, 2004 Author Share Posted August 3, 2004 Gifs is the animated gif image and g is: ? ? ?private void Panel_Resize(object sender, System.EventArgs e) ? ? ? ?{ ? ? ? ?Graphics g = e.Graphics; . . . What do you mean by drawing the frames myslef? I draw each frame of the animated gif. Link to comment Share on other sites More sharing options...
0 lexecutil Posted August 4, 2004 Share Posted August 4, 2004 Are you using System.Drawing.ImageAnimator? Dan Link to comment Share on other sites More sharing options...
0 smurfiness Posted August 4, 2004 Share Posted August 4, 2004 To accomplish this, the best way (aside from using ImageAnimator) would be to load all of the frames at once, each into its own variable, and then use a PictureBox to cycle through the images. Set the PictureBox's Image property to the image representing the current frame each time it switches. Link to comment Share on other sites More sharing options...
0 yyy Posted August 4, 2004 Author Share Posted August 4, 2004 OK,I'll try it.Thanks :laugh: Link to comment Share on other sites More sharing options...
Question
yyy
Hi,
I have a problem-my program uses an animated gif and that causes a rise in the CPU usage.Is there a way to minimize the rise of the CPU usage when using animated gifs?
Link to comment
Share on other sites
8 answers to this question
Recommended Posts