[AdvancedPaste] Add all supported image filetypes to ImageToText #35600
+15
−2
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 small list of supported image filetypes in AdvancedPaste's ClipboardHelper, replacing it with the full list of types obtained from BitmapDecoder directly.
PR Checklist
Detailed Description of the Pull Request / Additional comments
The current list of ".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".ico", ".svg" is incomplete. This PR obtains a list of all supported extensions from the BitmapDecoder itself. The full list on my Windows 11 machine is:
This includes several RAW camera formats and some variations for types already marked as supported but not included in the hardcoded list (including ".jfif" and ".jpe" for JPEG files, for example).
Note: BitmapDecoder on my machine does not include a reference to SVG files, although this was explicitly included in the previous hardcoded list. I tested the existing code with several SVG files, and it resulted in an error for me, so I have not added it back in:
I assume that if SVG is added as a WIC codec, that it will be transparently supported in Image to Text via the new enumeration method.
Validation Steps Performed
This was tested manually by executing the Image to Text function on a number of different filetypes. I do not have an example file for every file format, unfortunately, but I have tested JPEG, GIF, PNG, BMP, TIFF and others, including less common types like AVIF and EXIF.
I also confirmed that if the user didn't have HEIC codecs installed that the function correctly logged an error, but did not surface this to the UI.