This is a quick and dirty function I wrote to do analysis on image files. It simply returns the page count within a Bitmap object, or, -1 ($false) if an error occurs. More work to do on it, but, useful for now.
functionGetNumberOfPages
{
[CmdletBinding()]
param(
[Parameter(
Mandatory =$true,
ValueFromPipeline =$true,
ValueFromPipelineByPropertyName =$true
)]
[ValidateNotNullOrEmpty()]
[String]
$TiffImage
)
if(([appdomain]::currentdomain.getassemblies() | Where {$_-match"System.Drawing"}) -eq$null)