Public/Tools/ConvertFrom-Snapshot.ps1

function ConvertFrom-Snapshot {
    <#
    .SYNOPSIS
        Converts from the output provided by Get-Snapshot to a [System.Drawing.Image] object.
    .DESCRIPTION
        Converts from the output provided by Get-Snapshot to a [System.Drawing.Image] object. Don't
        forget to call Dispose() on Image when you're done with it!
    .EXAMPLE
        PS C:\> $image = Select-Camera | Get-Snapshot -Live | ConvertFrom-Snapshot
        Get's a live snapshot from the camera selected from the camera selection dialog, converts it
        to a System.Drawing.Image object and saves it to $image
    .INPUTS
        Accepts a byte array, and will accept the byte array from Get-Snapshot by property name. The property name for
        a live image is 'Content' while the property name for the JPEG byte array on a snapshot from recorded video is
        'Bytes'.
    .OUTPUTS
        [System.Drawing.Image]
    .NOTES
        Don't forget to call Dispose() when you're done with the image!
    #>

    [CmdletBinding()]
    [OutputType([system.drawing.image])]
    param(
        [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
        [Alias('Bytes')]
        [byte[]]
        $Content
    )

    process {
        if ($null -eq $Content -or $Content.Length -eq 0) {
            return $null
        }
        $ms = [io.memorystream]::new($Content)
        Write-Output ([system.drawing.image]::FromStream($ms))
    }
}