smourier / DirectN

Direct interop Code for .NET Framework, .NET Core and .NET 5+ : DXGI, WIC, DirectX 9 to 12, Direct2D, Direct Write, Direct Composition, Media Foundation, WASAPI, CodecAPI, GDI, Spatial Audio, DVD, Windows Media Player, UWP DXInterop, WinUI3, etc.
MIT License
311 stars 28 forks source link

How to pass `System.Windows.Media.Imaging.BitmapSource` to `WicBitmapSource.FromSource()` #28

Closed d2phap closed 2 years ago

d2phap commented 2 years ago

Hi, I'm playing around with this library on .NET 6 I use Magick.NET to read the image, then convert it to System.Windows.Media.Imaging.BitmapSource.

using var imgM = new MagickImage("photo.png");
System.Windows.Media.Imaging.BitmapSource src = imgM.ToBitmapSource();

using var bmp = WicBitmapSource.FromSource(src); // ERROR!

image

Is there any way to convert System.Windows.Media.Imaging.BitmapSource to WicNet.WicBitmapSource?

smourier commented 2 years ago

Hi,

Aren't you confusing with this library : https://github.com/smourier/wicnet (if yes, can you delete this one and recreate the same over there)?

d2phap commented 2 years ago

Oh yeah, I was checking both repo! Created here: https://github.com/smourier/WicNet/issues/2 Thank you!