zimmer9
asked on
How would you save an image array to a file in C#?
I created an image array as follows in C# using VS2010:
Image[] newImage = new Image[1000];
How can I save this image array to a file titled "L:\\F\\Source\\test1.tiff "
Image[] newImage = new Image[1000];
How can I save this image array to a file titled "L:\\F\\Source\\test1.tiff
Assuming that you meant that you have a byte array that you want to write to disk:
-saige-
using System.Drawing;
using System.IO;
namespace EE_Q28711066
{
class Program
{
static void Main(string[] args)
{
byte[] array = new byte[1000];
using (MemoryStream ms = new MemoryStream(array))
{
Image image = Image.FromStream(ms);
image.Save("EE_Q28711066.TIFF", System.Drawing.Imaging.ImageFormat.Tiff);
}
}
}
}
Otherwise, if you do in fact have an image array (that is an array of images), then you would either. Write each image to it's own file (using the method above) or combine the images into one file.-saige-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can save all the images in the array with :
foreach ( Image image in newImage )
{
image.Save("L:\\F\\Source\
}
However this is not intended or is it.