[Peek] Expand image format support for Image Previewer #35622
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
This removes the hardcoded list of file extensions from Peek's Image Previewer code, and instead relies upon the list returned from
BitmapDecoder
directly, which represents the formats the end user's system is capable of decoding.PR Checklist
Detailed Description of the Pull Request / Additional comments
The use of
GetDecoderInformationEnumerator()
to get all WIC-supported formats:Validation Steps Performed
This was tested manually with a test folder of images in a variety of different formats, from popular filetypes like JPEG and GIF, to AVIF, cursor files, JPEGXL, and several example RAW files. I also tested with other non-image files, such as PDF, text file, MP3 and videos, to ensure the other previewers were unaffected.
Note: I don't have an example file for every supported image format.
Additions and Removals
On my Windows 11 machine, this PR adds Peek support for the following types:
These were previously in the hardcoded list, but are not marked as compatible on my machine:
These may have been present on the original developer's machine when the list was curated. They should be picked up with this new code if a WIC decoder exists on the target machine for them.
Examples
Cursor:
JPEGXL (after adding system support via JXL WinThumb):
(Example JPEGXL images can be created by converting existing image files with https://squoosh.app/)
DNG (drone footage still):
Important Note
HEIC and JPEGXL are marked in Windows as compatible, but require separate installation. For HEIC this means paying a licence, as it is patent-encumbered. For JPEGXL, Windows support is not yet built-in, but can be added via a third party extension. If the user does not have a WIC-compatible codec installed, there will be no change from the previous version of Peek, i.e. the UnsupportedFilePreviewer will be used to show overview information of the file: