Retrieve Page Count from Multi Page Tiff files

have a look here:

System.Drawing.Image.FromFile(YourFullFilePath).GetFrameCount(System.Drawing.Imaging.FrameDimension.Page)

To retrieve all tiff files from a folder we can use e.g. the Directory.GetFiles(… ) Method.
When we can rely on only one filetype extension.

Some files can have the extension TIFF, others also Tif with only one f. We can handle this as following:

arrFullTifFilePath | String Array - String() =

(From fi In New DirectoryInfo(ImageFolder).GetFiles()
Where {".TIF",".TIFF"}.contains(fi.Extension.toUpper())
Select f = fi.FullName).toArray

So a initial modelling could look like this:
Variables:
grafik

Flow:

pgCount = System.Drawing.Image.FromFile(item).GetFrameCount(System.Drawing.Imaging.FrameDimension.Page)
String.Format("File: {0} has PageCount {1}", Path.GetFileName(item), pgCount)

Output:
grafik

Demo files:
TIFF_MultiPageTiff_GetPageCount.zip (2.1 KB)

1 Like