Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TheJoeFin opened this issue May 26, 2024 · 4 comments

Comments

@TheJoeFin
Copy link

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'
@rubenscordeirobr
Copy link
Contributor

Hello Dirk Lemstra

I would like to work on this issue. First, it will be necessary to create an extra project, as MAUI supports multiple targets, such as net8.0-android, net8.0-ios, and net8.0-maccatalyst.

Suggested name: Magick.NET.Maui
Extension: IMagickImageExtensions
Method: ToImageSourceAsync

Convert MagickImage to Microsoft.Maui.Controls.ImageSource

Let me know your thoughts.

@dlemstra
Copy link
Owner

This issue is about the WinAppSDK and not MAUI?

I don't mind if we also add a MAUI implementation but that would be a different implementation that what this issue was raised for. That library should be called Magick.NET.MicrosoftMauiControls to have the same style as the other projects.

@rubenscordeirobr
Copy link
Contributor

Sorry for the misunderstanding. If you allow me, I would like to work on both of them. First, I will start with the MicrosoftMauiControls implementation because I need to use it in my personal project.

@dlemstra
Copy link
Owner

dlemstra commented Nov 9, 2024

Have you made any progress with this @rubenscordeirobr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants