dlemstra / dlemstra/Magick.NET

Create ToImageSource() method similar to ToBitmapSource() to support WinAppSDK Images

Open
#1,644 4 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
C#
Stars
4k
Forks
451
Avg merge
11h 55m
Merged PRs (30d)
3

Description

### Is your feature request related to a problem? Please describe

In my app Simple Icon File Maker opening different image types can cause errors if they are unsupported by WinAppSDK by default, but ImageMagick. Does support them but to load the image into Image Magick and back to the Image.Source take more work. The WPF method ToBitmapSource is amazing for this solution and I'd love to have the same option for my WinAppSDK apps.

### Describe the solution you'd like

I would like to be able to set the Source of an Image using a single method `.ToImageSource()` which is a method on `MagickImage`

### Describe alternatives you've considered

I can do it with Byte Arrays or saving to a file and loading again, but that is inefficient and extra work for no extra value. The WPF method is the best experience updating it for WinAppSDK would be ideal.

### Additional context

The error I get when trying to use `.ToBitmapSource()` is

```
CS0029: Cannot implicitly convert type ‘System.Windows.Media.Imaging.BitmapSource’ to ‘Microsoft.UI.Xaml.Media.ImageSource'
```

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.