I am a relative novice with imaging in C#. This is my first question on this board after a very long time of being a member. I hope it can help me get through this tricky scenario.
I need to read the contents (frames) of a Multi Page TIFF, saving each one into a List and finally returning it to then do some work with it.
Heres my code so far
public static List<Image> GetAllPages(string file)
{
images = new List<Image>();
using (Image img = Image.FromFile(file))
{
try
{
for (int i = 0; i < img.GetFrameCount(FrameDimension.Page); i++)
{
img.SelectActiveFrame(FrameDimension.Page, i);
MemoryStream byteStream = new MemoryStream();
img.Save(byteStream, ImageFormat.Tiff);
images.Add(Image.FromStream(byteStream));
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
return images;
}
IMPORTANT - This actually works like a charm when executing on Windows 7. However, when attempting the same on a Windows XP I get the seemedly well known Generic GDI+ error.
Is there anything obvious i am missing here? If not, would there be any other, more efficient way to return a list of images, extracted from a multi page tiff?
I would greatly appreciate any help anyone can give.