I
tried this code below and it worked. But the problem is that, the
quality is not good, I can see some colors are not good. I want to
create gif that has good quality of resolution.
* create Gif */
//you should replace filepath
String[] imageFilePaths = new String[] { @"c:\gif\1\1.png", @"c:\gif\2\2.png", @"c:\gif\3\3.png", @"c:\gif\4\4.png", @"c:\gif\5\5.png", @"c:\gif\6\6.png"};
String outputFilePath = "c:\\test.gif";
AnimatedGifEncoder e = new AnimatedGifEncoder();
e.Start( outputFilePath );
e.SetDelay(500);
//-1:no repeat,0:always repeat
e.SetRepeat(0);
for (int i = 0, count = imageFilePaths.Length; i < count; i++ )
{
e.AddFrame( Image.FromFile( imageFilePaths[i] ) );
}
e.Finish();
Please help me this is urgent
* create Gif */
//you should replace filepath
String[] imageFilePaths = new String[] { @"c:\gif\1\1.png", @"c:\gif\2\2.png", @"c:\gif\3\3.png", @"c:\gif\4\4.png", @"c:\gif\5\5.png", @"c:\gif\6\6.png"};
String outputFilePath = "c:\\test.gif";
AnimatedGifEncoder e = new AnimatedGifEncoder();
e.Start( outputFilePath );
e.SetDelay(500);
//-1:no repeat,0:always repeat
e.SetRepeat(0);
for (int i = 0, count = imageFilePaths.Length; i < count; i++ )
{
e.AddFrame( Image.FromFile( imageFilePaths[i] ) );
}
e.Finish();
Please help me this is urgent
Marvin ReidPosted Nov 15, 2022, 10:27 PM
You can use the RasterCodecs Save method to combine your images into a Gif file. You can then leverage the RasterImageAnimator class to display the gif animation. Here is some sample code and resources for this:
https://www.leadtools.com/help/sdk/tutorials/dotnet-winforms-convert-a-multipage-image-to-reverse-animated-gif.html
https://www.leadtools.com/help/sdk/tutorials/dotnet-console-create-a-multipage-file-from-multiple-images.html
Lalit MPosted Dec 14, 2009, 12:17 AM