Detector reference
Image magic numbers and container signatures
This is the shared registry used by the local format detector. A magic number identifies a likely structure; bounded structural checks then reduce false positives and expose incomplete data.
| Format | Container | Signature | Extensions | Bounded checks |
|---|---|---|---|---|
| JPEG image image/jpeg, image/jpg | JPEG codestream | FF D8 FF | .jpg, .jpeg, .jpe | Starts with the JPEG start-of-image marker followed by a marker byte. Reads a bounded start-of-frame segment; no pixel data is decoded. JPEG is reported as a still image. Embedded thumbnails are not counted as images. ITU-T T.81 JPEG specification |
| PNG image image/png | PNG chunk stream | 89 50 4E 47 0D 0A 1A 0A | .png, .apng | Uses the complete eight-byte PNG signature and validates bounded chunk lengths. Reads width and height from a valid IHDR chunk. An acTL chunk before IDAT identifies APNG animation and declares its frame count. W3C Portable Network Graphics specification |
| GIF image image/gif | GIF data stream | 47 49 46 38 37 61 or 47 49 46 38 39 61 | .gif | Requires an exact GIF87a or GIF89a logical-screen header. Reads the little-endian logical-screen width and height. Walks bounded extension and image sub-blocks; two image descriptors prove animation. W3C GIF89a specification |
| WebP image image/webp | RIFF WebP container | 52 49 46 46 .... 57 45 42 50 | .webp | Requires both the RIFF marker and WEBP form type, then validates bounded chunk sizes. Reads VP8, VP8L, or VP8X dimension fields without decoding pixels. Uses the VP8X animation flag and ANIM/ANMF chunks when present. Google WebP RIFF container specification |
| HEIC / HEIF image image/heic, image/heif, image/heic-sequence, image/heif-sequence | ISO Base Media File Format | .... 66 74 79 70 plus a HEIF-compatible brand | .heic, .heif, .hif | Validates the ftyp box and distinguishes its major and compatible brands. Uses a structurally valid, bounded ispe property when one is available. msf1 and sequence brands prove a sequence; other HEIF containers remain unknown. Library of Congress HEIF format description |
| AVIF image image/avif, image/avif-sequence | ISO Base Media File Format | .... 66 74 79 70 plus avif or avis brand | .avif | Validates the ftyp box and requires the avif or avis major/compatible brand. Uses a structurally valid, bounded ispe property when one is available. The avis brand identifies an AVIF image sequence. Alliance for Open Media AVIF specification |
| TIFF image image/tiff, image/tif | TIFF image file directory | 49 49 2A 00 or 4D 4D 00 2A | .tif, .tiff | Requires a valid little-endian or big-endian TIFF header and bounded first-IFD offset. Reads ImageWidth and ImageLength from bounded IFD entries. A non-zero next-IFD pointer proves another page; otherwise the state is conservative. Adobe TIFF 6.0 specification |
| BMP image image/bmp, image/x-ms-bmp | Windows bitmap | 42 4D | .bmp, .dib | Requires the BM signature and a supported bounded DIB header. Reads dimensions from BITMAPCOREHEADER or BITMAPINFOHEADER-compatible fields. BMP is a single still-image container. Microsoft bitmap header documentation |
| ICO icon image/x-icon, image/vnd.microsoft.icon | ICO resource directory | 00 00 01 00 | .ico | Validates the reserved field, icon type, count, and bounded directory table. Reads dimensions from resource directory entries; zero represents 256 pixels. Multiple directory entries are reported as multiple embedded icon images. Microsoft icon resource documentation |
| Windows cursor image/x-icon, image/vnd.microsoft.icon | CUR resource directory | 00 00 02 00 | .cur | Validates the reserved field, cursor type, count, and bounded directory table. Reads dimensions from resource directory entries; zero represents 256 pixels. Multiple directory entries are reported as multiple embedded cursor images. Microsoft icon and cursor format overview |
| SVG image image/svg+xml, text/xml, application/xml | XML text | UTF text leading to an <svg> root element | .svg, .svgz | Scans only a bounded UTF-8 preamble and accepts XML declarations, comments, and doctype text. Reads simple numeric width/height attributes or a four-number viewBox when present. Bounded animate/set elements can prove animation; absence may remain unknown. W3C SVG 2 specification |
| PDF document application/pdf | PDF document | 25 50 44 46 2D (%PDF-) | Finds a PDF header within the permitted leading-byte window and checks the bounded tail for %%EOF. Page dimensions are not inferred by the signature inspector. Page and embedded-image counts require a PDF parser and remain unknown here. PDF Association syntax overview |
Signature, then structure
A short prefix is necessary but not always sufficient. Length fields and container markers are checked before metadata is reported.
Claims stay separate
The browser-provided MIME and filename extension are shown as claims. They do not decide the detected format.
Unknown is useful
A bounded parser reports unknown when the evidence is incomplete. It never guesses merely to produce a result.