Guess image fromat from magic number
Author: yutsukuCreated Aug 7, 2026Updated Sep 15, 2026
Labels🎯 feature👌🏻 ready
Windows OS version
Windows 10 22H2 OS Build 19045.6466
ImageGlass version
9.6.0.801
ImageGlass release
Classic
1️⃣ Describe the feature
I would like the program, in addition to just guessing from file extension to:
- use a list of know magic bytes (https://en.wikipedia.org/wiki/List_of_file_signatures) for supported image formats WHEN image decoding fails
2️⃣ How to use feature
- Download a
*.webpfile served with*.jpgextension from the web (or rename yourself to simulate this). - Current behaviour:
- try to open it with ImageGlass,
- it fails to decode image (assumes jpeg),
- displays error message
- Wanted behaviour:
- try to open it with ImageGlass,
- it fails to decode image (assumes jpeg),
- fallbacks to guess by reading few bytes of the file,
- looks up in known lists,
- gets a match,
- uses appropriate decoder (webp),
- displays the image.
3️⃣ Additional context
Would possibly help to fix an issue where the program is unable to open files without extension https://github.com/d2phap/ImageGlass/issues/523
Source: d2phap/ImageGlass