Method TryDetect
- Namespace
- MailFathom.Application.Portraits
- Assembly
- MailFathom.Application.dll
TryDetect(ReadOnlySpan<byte>, out PortraitImageType)
Reads what kind of image the octets are, from the signature the format opens with.
public static bool TryDetect(ReadOnlySpan<byte> content, out PortraitImageType type)
Parameters
contentReadOnlySpan<byte>The octets as they were supplied.
typePortraitImageTypeThe kind the octets are, or the struct default when they are neither.
Returns
Remarks
The signature is the whole of the check, deliberately: nothing here decodes an image, so a file that opens as a JPEG and is damaged after its first octets is stored and served as the person supplied it. What the check is for is that a portrait is an image at all rather than a script or an archive wearing an image's content type.