Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i tried to resize Gif image but after resizing it will not animating. i tried following code resize.

What I have tried:

LastBitImg = new Bitmap(Convert.ToInt32(FNewWidth), Convert.ToInt32(height));
                        LastBitImg = FBitImg;
Posted
Updated 30-Jan-18 3:16am
Comments

1 solution

An animated GIF is not a single image but a sequence of images (also called frames) with additional data like the frame delay. You have to split the animated GIF into it's frame images as bitmaps, resize them, and create a new animated GIF using the original frame data.

There is an article here at CP on creating animated GIFs with .Net: NGif, Animated GIF Encoder for .NET[^].

Alternatively use an image library that supports resizing animated GIFs like ImageMagick (there is a .Net wrapper at GitHub: dlemstra/Magick.NET[^] ).
 
Share this answer
 
Comments
rocker_003 31-Jan-18 4:17am    
i have stored gif image into bitmap... now how can i seperate its frames and resize one by one frames?
Jochen Arndt 31-Jan-18 4:46am    
You have to extract the multiple frames of an animated GIF into multiple bitmaps.
Use Image.FrameDimensionsList() to get a list of information about the frames (the size of the list is the number of frames) where each list entry is of type FrameDimension.
Then use Image.SelectActiveFrame() to access each frame (image) and store it as bitmap.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900