selective-php / image-type

Image type (format) detection for PHP
MIT License
7 stars 4 forks source link

Detect JPEG File Interchange Format (JFIF) #72

Closed odan closed 5 years ago

odan commented 5 years ago

Details

Examples

Identification

It uses Application Segment #0, with a segment header consisting of the null-terminated string spelling "JFIF" in ASCII followed by a byte equal to 0, and specifies that this must be the first segment in the file, hence making it simple to recognize a JFIF file.

Valid JFIF files begin with FF D8 FF E0 ?? ?? 'J' 'F' 'I' 'F' 00. Some technically-invalid files exist in which the JFIF segment has been relocated, and for them this signature will not match.

odan commented 5 years ago

This is technically the same as JPEG. Also the header is the same.