Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i convert a Png file to Gif in memory?
    text
    copied!<p>This is the code:</p> <pre><code>if (Form1.sf != null) { radarDI = new DirectoryInfo(Form1.sf); radarFiles = radarDI.GetFiles("*.png"); for (int i = radarFiles.Length - 1; i &gt;= 0; i--) { radarImage = Image.FromFile(radarFiles[i].Name); radarImage.Save(FileName, System.Drawing.Imaging.ImageFormat.Gif); myGifListRadar.Add(radarFiles[i].Name); if (myGifListRadar.Count == 5) { break; } } radar_animation.MakeGIF(myGifListRadar, @"d:\RadarGifAnimatoion.gif", 8, true); } </code></pre> <p>I want to convert all the png files to gif. Since I need to create animated gif and it's getting only gif files. So now im saving the png files to the hard disk make the convertion and then reading back the gif files from the hard disk:</p> <pre><code>radarImage.Save(FileName, System.Drawing.Imaging.ImageFormat.Gif); </code></pre> <p>FileName should be later on the files im saving and then reading back to use it. The question is if there is any way to convert the files to gif without saving it to the hard disk first ? Some quicker way then saving the files to the hard disk convert then read them again as gif's with FileInfo again ?</p> <p>Just updated:</p> <pre><code>using (var ms = new MemoryStream()) { if (Form1.sf != null) { radarDI = new DirectoryInfo(Form1.sf); radarFiles = radarDI.GetFiles("*.png"); for (int i = radarFiles.Length - 1; i &gt;= 0; i--) { radarImage = Image.FromFile(radarFiles[i].FullName); radarImage.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); myGifListRadar.Add(radarFiles[i].Name); if (myGifListRadar.Count == 5) { break; } } } radar_animation.MakeGIF(myGifListRadar, @"d:\RadarGifAnimatoion.gif", 8, true); } </code></pre> <p>But now this part:</p> <pre><code>radarImage.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); myGifListRadar.Add(radarFiles[i].Name); </code></pre> <p>myGifListRadar is List how can I add now the radarImage to the List as string file name ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload