How to: Get Image Page Count in .NET C#

How to get image page count in .NET C#

private int GetTotalpages(string filePath)
{
int pageCount = 0;
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
using (Image temp = Image.FromStream(fs))
{
pageCount = temp.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
}
}

return pageCount;
}

KyoungSu Do
Software Developer
ImageSource, Inc.