Last post Nov 05, 2010 05:21 AM by mattt
Nov 03, 2010 08:30 AM|mattt|LINK
I can't quite believe that this hasn't been encountered and handled hundreds of times before, but it seems not. There we go. The problem is very simple. If you do this:
Dim resizedImage As System.Drawing.Bitmap
Dim Width, Height As Integer
resizedImage = New System.Drawing.Bitmap(Width,Height)
canvas = System.Drawing.Graphics.FromImage(resizedImage)
canvas.DrawImage(imgToResize, 0, 0, calculatedSize.Width, calculatedSize.Height)
And "imgToResize" is an animated GIF, you loose the animation. I've tried a variety of methods to try and resize the image including using Image.GetThumbnailImage and some of the classes in System.Graphics but the result is always the same: the image saves
but it looses it's animation.
Doing some research on the internet I discovered that you can set a System.Drawing.Imaging.EncoderValue.MultiFrame Encoding Parameter - but it only seems to work for animated TIFF files. So that's not a lot of help.
I also discovered the System.Drawing.ImageAnimator class which was new to me, but again this seems to be made to render animated images rather than to help resize them, so I can't see how it's helpful.
Can anyone tell me how I can resize an animated GIF and retain it's animation?
Nov 04, 2010 06:56 PM|BoogleC|LINK
I get the general feeling that isn't easy (just had a quick snoot around). Obviously you could do this in Photoshop/other image manipulating software so i'm wandering if it's possible to tap into these by using a helper method? It could be a new route to
research as I'm not really sure keeping the animation is possible by using the standard .NET Classes.
Nov 05, 2010 05:21 AM|mattt|LINK
Interesting idea on using an API call to do the job. I have no idea if photoshop or anything else offers something that will interface with .net (we use GIMP here) but I'll look into it.