It appears to be fairly common for JPEG files (and possibly other formats?) to be misidentified with a HEIC file extension.
See issue #1 and #3 for examples of JPEG images with a HEIC file extension.
The format detection can be run on the error code path, when libheif returns heif_error_Invalid_input with heif_suberror_No_ftyp_box.
It would consist of checking the first few bytes of the file for the magic number signature of different image formats.
If the image format is supported by GDI+, it will be loaded using Document.FromGdipImage.
All JPEG files start with the signature FFD8, the 'Start of Image' marker.
It appears to be fairly common for JPEG files (and possibly other formats?) to be misidentified with a HEIC file extension. See issue #1 and #3 for examples of JPEG images with a HEIC file extension.
The format detection can be run on the error code path, when libheif returns
heif_error_Invalid_input
withheif_suberror_No_ftyp_box
. It would consist of checking the first few bytes of the file for the magic number signature of different image formats. If the image format is supported by GDI+, it will be loaded usingDocument.FromGdipImage
.All JPEG files start with the signature
FFD8
, the 'Start of Image' marker.