dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.41k stars 980 forks source link

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

Open kseelam01 opened 1 year ago

kseelam01 commented 1 year ago

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 ?

dotnet-issue-labeler[bot] commented 1 year ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost commented 1 year ago

Tagging subscribers to this area: @dotnet/area-system-drawing See info in area-owners.md if you want to be subscribed.

Issue Details
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 ?
Author: kseelam01
Assignees: -
Labels: `untriaged`, `Pri3`, `area-System.Drawing`
Milestone: -
carlossanlop commented 1 year ago

@JeremyKuhne can you please take a look?

kseelam01 commented 1 year ago

Is there any update on this issue ? Are you able to see the issue and Is the issue reproducible?

elachlan commented 1 year ago

related: #9107