Class ImageBytesDetector
- Namespace
- Kuestenlogik.Bowire.Semantics.Detectors
- Assembly
- Kuestenlogik.Bowire.dll
Detects string-typed leaves whose base64 prefix decodes to bytes matching a known image magic-number: PNG, JPEG, GIF87a / 89a, WebP, AVIF. Only the first 12 bytes are decoded so the cost is bounded regardless of the payload size.
public sealed class ImageBytesDetector : IBowireFieldDetector
- Inheritance
-
ImageBytesDetector
- Implements
- Inherited Members
Remarks
Magic table:
- PNG —
89 50 4E 47 0D 0A 1A 0A. - JPEG —
FF D8 FF. - GIF —
47 49 46 38 [37|39] 61(GIF87a or GIF89a). - WebP — RIFF header at byte 0 + WEBP at byte 8.
- AVIF —
ftyp+avifbrand at byte 4.
The 12-byte window is the minimum needed to discriminate WebP and AVIF (both have content past byte 8 that disambiguates them from other RIFF/ftyp containers).
Constructors
ImageBytesDetector()
public ImageBytesDetector()
Properties
Id
Stable id used by logging + the future "registered detectors"
surface. Conventionally a dotted namespace
(kuestenlogik.wgs84-coordinate); not required to be a URI.
public string Id { get; }
Property Value
Methods
Detect(in DetectionContext)
public IEnumerable<DetectionResult> Detect(in DetectionContext ctx)
Parameters
ctxDetectionContext