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"
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ronald BusterOwnerCommented:
I don't know what you are doing because you have an array of images limited to 1000

You can save all the images in the array with :

foreach ( Image image in newImage )
   image.Save("L:\\F\\Source\\test1.tiff", System.Drawing.Imaging.ImageFormat.Tiff);

However this is not intended or is it.
Assuming that you meant that you have a byte array that you want to write to disk:
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);

Open in new window

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.

Since you picked a .tiff, I'm guessing you're actually talking about creating a multi-frame tiff file, one frame for each source image in the array.  A lot more complicated than normal image saving, but not too bad.
You need to use the image encoding variables in System.Drawing.Imaging.

This should get you most of the way:

.net 2, but still does the trick.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.