Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Peek] Expand image format support for Image Previewer #35622

Conversation

daverayment
Copy link
Contributor

@daverayment daverayment commented Oct 27, 2024

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:

  • Automatically picks up new codec support if installed on a user's system
  • Is more accurate, directly reflecting what the system can handle
  • Future-proofs the code against new image formats, i.e. we don't have to add to the list of supported extensions if Windows adds more (like HEIC etc.)

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:

.rle
.icon
.cur
.exif
.dng
.dds
.avci
.heics
.heifs
.avcs
.avifs
.PTX
.PXN
.DNG
.JXL

These were previously in the hardcoded list, but are not marked as compatible on my machine:

.jfi
.jif
.thumb
.r3d
.rwz

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:
image

JPEGXL (after adding system support via JXL WinThumb):
image

(Example JPEGXL images can be created by converting existing image files with https://squoosh.app/)

DNG (drone footage still):
image

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:

image

This comment has been minimized.

@crutkas
Copy link
Member

crutkas commented Oct 28, 2024

This is real fire

@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Oct 29, 2024
Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution!

".fff",
".mef",

// ".mdc", // Crashes in GetFullBitmapFromPathAsync
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we should exclude this one as well... Did you test it? Couldn't find an accessable file to give it a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jaimecbernardo !

On my Windows 11 machine, ".mdc" files are not supported by BitmapDecoder / WIC, so this new version of Peek still won't attempt to load them via ImagePreviewer. The files' basic properties will be shown by the UnsupportedFilePreviewer instead.

I'm not sure why it was in the list originally then commented out later. I wonder if the author had the Minolta RAW plugin registered and that lit up support on their machine, but that's just a guess.

To answer your question: I've downloaded a bunch of RAW files over the last few months, but I don't have a complete set to match the full list of formats supported by Windows. (Perhaps downloading and testing them all would be a good exercise for a rainy day!). https://www.rawsamples.ch/ has some MDC file downloads, but they've never rendered for me because of them not being natively supported. I haven't had any issues with RAW images I tried with extensions which BitmapDecoder reports as compatible.

Long story short: we don't need to explicitly exclude ".mdc" from the list!

@jaimecbernardo jaimecbernardo added Good to Merge and removed Needs-Review This Pull Request awaits the review of a maintainer. labels Nov 22, 2024
@jaimecbernardo jaimecbernardo merged commit b81478e into microsoft:main Nov 22, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants