dotnet / dotnet/winforms

Does the dotnet api support decoding webp images in Windows Server 2022(Version 21H2 and Os build 20348.1607)

Open
#9,014 5 comments 1 reaction 1 assignee Claimed by @JeremyKuhne View on GitHub
area-System.Drawing
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

Hello,

My existing code works with System.Drawing.Image API which isn't working for some image formats as webp and throws Parameter is not valid exception. Hence I'm trying to decode webp format images using BitmapDecoder in System.Windows.Media.Imaging. The decoding is working fine on windows 11 but getting the error ''No imaging component suitable to perform this operation was found. COM Initialization failed.'' on Windows Server 2012 or Windows Server 2022.

Here the error stackTrace:

```
'BitmapDecoder.CreateFromUriOrStream(null, null, origStream, BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.Default, null, true)' threw an exception of type 'System.NotSupportedException'
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233067
HelpLink: null
IPForWatsonBuckets: 0x652a8822
InnerException: {"The component cannot be found. (Exception from HRESULT: 0x88982F50)"}
IsTransient: false
Message: "No imaging component suitable to complete this operation was found."
RemoteStackTrace: null
Source: "PresentationCore"
StackTrace: " at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle)\r\n at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache)"
TargetSite: {System.Windows.Media.SafeMILHandle SetupDecoderFromUriOrStream(System.Uri, System.IO.Stream, System.Windows.Media.Imaging.BitmapCacheOption, System.Guid ByRef, Boolean ByRef, System.IO.Stream ByRef, System.IO.UnmanagedMemoryStream ByRef, Microsoft.Win32.SafeHandles.SafeFileHandle ByRef)}
```

I've tried converting webp images to other formats and use the stream with System.Drawing,Image But was throwing Parameter not valid error.
Does the Windows Server 2022(Version 21H2 and Os build 20348.1607) support decoding of webp images and if not when would the windows updates for the same be provided ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.