---
title: "How to convert images in a folder to new formet"  
description: "How to convert images in a folder to new formet"  
author: "Anonymous User"  
published: 2015-02-05  
updated: 2015-02-05  
canonical: https://www.mindstick.com/forum/12946/how-to-convert-images-in-a-folder-to-new-formet  
category: "asp.net"  
tags: ["mvc", "mvc4"]  
reading_time: 1 minute  

---

# How to convert images in a folder to new formet

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) a [group](https://yourviews.mindstick.com/view/81323/adani-green-energy-group-bags-world-s-biggest-solar-bid) of [images](https://www.mindstick.com/interview/1067/what-is-the-php-predefined-variable-that-tells-the-what-type-of-images-that-php-support) in a folder to animated gif and facing error "[Cannot access](https://www.mindstick.com/forum/33726/inside-onclicklistener-i-cannot-access-a-lot-of-things-how-to-approach) a closed [Stream](https://yourviews.mindstick.com/view/88509/us-intercepts-iranian-tanker-m-t-stream-amid-hormuz-tensions).".Also there must be error in [display image](https://www.mindstick.com/forum/33970/how-to-display-image-without-streach-in-uiscrollview) as lable..

```
protected void Button1_Click(object sender, EventArgs e) {    //Variable declaration    MemoryStream memoryStream;      binaryWriter = new BinaryWriter(stream);     int numFiles = fileEntries.Length;    for (int picCount = 0; picCount < numFiles; picCount++)    {        image = System.Drawing.Image.FromFile(fileEntries[picCount]);          image.Save(memoryStream, ImageFormat.Gif);                buf1 = memoryStream.ToArray();                 memoryStream.SetLength(0);      }    binaryWriter.Close();    System.Drawing.Image streamGIF = System.Drawing.Image.FromStream(stream);   Label1.Text += "<img src=" + streamGIF + " /><br />";}
```

## Replies

### Reply by Anonymous User

You need to store the [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) first on drive and then give its path to image tag.

```
System.Drawing.Image streamGIF = System.Drawing.Image.FromStream(stream);string imageName = "~/Images/test.gif";string savePath = Server.MapPath(@"Images\test.gif");       streamGIF.Save(savePath, System.Drawing.Imaging.ImageFormat.Gif);           binaryWriter.Close();img1.ImageUrl = imageName;
```


---

Original Source: https://www.mindstick.com/forum/12946/how-to-convert-images-in-a-folder-to-new-formet

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
