You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading / saving a texture back to a file, we find that WICFormatHelper.GetForFilename performs a case sensitive search on the file extension to determine the desired format. However, at least on Windows, file extensions are case insensitive and therefore this unexpectedly gives an ArgumentException for upper or (pathological) mixed case extensions.
Further, the list of supported extensions also appears incomplete. Taking the results returned by .NET WPF's System.Windows.Media.Imaging.BitmapDecoder.CodecInfo.FileExtensions as a baseline, we might expect at least the following to be mapped as well:
.dib, .rle => GUID.GUID_ContainerFormatBmp
.jpe, .jfif, .exif => GUID.GUID_ContainerFormatJpeg
.tif => GUID.GUID_ContainerFormatTiff
Clearly users can work round the above by using the SaveTexture overload which passes a FileStream and ImageFormat directly but it would be nice if the above concerns were addressed.
The text was updated successfully, but these errors were encountered:
Since this is using WIC then it should be possible in principle to support and correctly map all of the file extensions that WIC specifies support for.
It'd require a linear scan through all of the codecs and their extensions, but that shouldn't be very expensive (compared to the decoding and file I/O ...).
…ile extension
FixesSergio0694#799.
Ensures case insensitive comparison of the file extension.
Manually maps all supported file extensions listed by built in container formats.
elyoh
added a commit
to elyoh/ComputeSharp
that referenced
this issue
Aug 27, 2024
ComputeSharp/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs
Line 112 in 94fe99a
When loading / saving a texture back to a file, we find that
WICFormatHelper.GetForFilename
performs a case sensitive search on the file extension to determine the desired format. However, at least on Windows, file extensions are case insensitive and therefore this unexpectedly gives anArgumentException
for upper or (pathological) mixed case extensions.Further, the list of supported extensions also appears incomplete. Taking the results returned by .NET WPF's
System.Windows.Media.Imaging.BitmapDecoder.CodecInfo.FileExtensions
as a baseline, we might expect at least the following to be mapped as well:.dib, .rle => GUID.GUID_ContainerFormatBmp
.jpe, .jfif, .exif => GUID.GUID_ContainerFormatJpeg
.tif => GUID.GUID_ContainerFormatTiff
Clearly users can work round the above by using the SaveTexture overload which passes a
FileStream
andImageFormat
directly but it would be nice if the above concerns were addressed.The text was updated successfully, but these errors were encountered: