Method Compute
Compute(byte[])
Computes the fingerprint of an encoded image file, as the picture is displayed: the orientation the file states (EXIF) is applied first, so a photo stored sideways with an orientation tag has the fingerprint of its upright copy.
public static ImageFingerprint Compute(byte[] data)
Parameters
databyte[]The encoded image (JPEG, PNG, WebP, TIFF, ...). The first page of a multi-page file is read.
Returns
- ImageFingerprint
The fingerprint of the displayed picture.
Exceptions
- ArgumentNullException
Thrown if
datais null.- ArgumentException
Thrown if
datais empty.- InvalidOperationException
Thrown if the data cannot be decoded as an image.
Compute(byte[], int)
Computes the fingerprint of one page of an encoded image file, as the picture is displayed. See Compute(byte[]).
public static ImageFingerprint Compute(byte[] data, int pageIndex)
Parameters
databyte[]The encoded image (JPEG, PNG, WebP, TIFF, ...).
pageIndexintZero-based page of a multi-page file (a TIFF scan). The orientation a file states describes its first page and is applied to that page only.
Returns
- ImageFingerprint
The fingerprint of the page.
Exceptions
- ArgumentNullException
Thrown if
datais null.- ArgumentException
Thrown if
datais empty.- ArgumentOutOfRangeException
Thrown if the file does not hold the page.
- InvalidOperationException
Thrown if the data cannot be decoded as an image.
Compute(ImageBuffer)
Computes the fingerprint of decoded pixels, exactly as the buffer holds them. A buffer decoded from a file that states an orientation holds the stored pixels, not the displayed picture: use Compute(byte[]) on the file to honor it.
public static ImageFingerprint Compute(ImageBuffer image)
Parameters
imageImageBufferThe image to describe. It is never modified. Transparent areas are read as white.
Returns
- ImageFingerprint
The fingerprint of the image.
Exceptions
- ArgumentNullException
Thrown if
imageis null.- ArgumentException
Thrown if the image has no pixel.
- ObjectDisposedException
Thrown if the image has been disposed.