Fix inability to load certain JPG files #700
Merged
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.
Fixes #698. The code was setting
setDecideFormatFromContent
totrue
, which based on my understanding means that Qt isn't allowed to use the file's extension as a hint to pick the proper decoder. This made it scan all decoders, and the RAW decoder is claiming it can decode the file for some reason. This setting is not to be confused withsetAutoDetectImageFormat
which is enabled by default, so in case a file is missing an extension, it will still open properly (except for these rare cases where the auto detection gets confused), or even if it has the incorrect extension, Qt will realize that the hint provided by the filename extension is incorrect and fall back to querying all decoders.The code enabling
setDecideFormatFromContent
was originally added in 97f1089 which was supposedly to fix #28, but I have no problem opening a JPG renamed as PNG even after this change, so maybe a different part of that commit was responsible for fixing it, or Qt improved their image loading since then (it works fine for me even with the legacy 5.15.2 builds by the way).