Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Determine supported image file types by checking the file header
Previously, the image format was determined by checking the file extension. This commit updates the implementation to determine the image format by checking the file header. The format of a file is determined by its internal bit layout rather than its extension. File extensions are merely human-readable metadata and do not reflect the actual contents of a file. For instance, renaming a .jpg file to another extension does not alter its internal format and could result in a file of a completely different type, such as a harmful executable. Relying solely on file extensions to determine file format is unreliable, as it may lead to incorrect results. Instead, file headers contain unique, format-specific signatures that provide a more accurate and stable method for identifying a file's true nature.
- Loading branch information