I have more than a hundred tif files to import images from. When I am reading a tif file, it shows a framecount of 1. This indicates to me one page. However, when I view the file in Microsoft Photos, it shows multiple pages that you can scroll through.
I need to programatically scroll through the pages using c#. Then, when a page is selected, I would save it as a jpeg.
Can someone help me understand how to work through the tif pages.
The code below works in .net and displays the first page.
Thanks in advance
System.Drawing.Image img;
System.Drawing.Image[] images;
int frameCount;
if (Filedatagrid.Rows[e.RowIndex].Cells[3].Value.ToString() == "tif")
{
img = System.Drawing.Image.FromFile(in_directory_path);
frameCount = img.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
images = new System.Drawing.Image[frameCount];
for (int i = 0; i < frameCount; i++)
{
img.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, i);
images[i] = (System.Drawing.Image)img.Clone();
}
img.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, 0);
pictureBox1.Image = (System.Drawing.Image)img.Clone();
}