dotnet / Microsoft.Maui.Graphics

An experimental cross-platform native graphics library.
MIT License
682 stars 63 forks source link

[Enhancement] Cross-platform image load/save APIs #141

Open davidbritch opened 3 years ago

davidbritch commented 3 years ago

While it's possible to use GraphicsService.LoadImageFromStream to load images from a variety of sources (local files, embedded files etc.), it seems to involve writing platform code if the image isn't an embedded resource. Ditto for IImage.Save.

For MAUI usage, a fully cross-platform image load/save API would be beneficial so that you could load/save an image from/to a known location, without having to resort to platform code.

charlesroddie commented 3 years ago

While it's possible to use GraphicsService.LoadImageFromStream to load images from a variety of sources (local files, embedded files etc.), it seems to involve writing platform code

So you have a valid stream but it doesn't work. So this is a bug report about GraphicsService.LoadImageFromStream?

jonlipsky commented 3 years ago

@davidbritch I'm not sure what the issue/ask is. Loading images from a Stream seems (to me) to be the most cross platform approach to take. Are you looking for extension methods that hides file management as well?

davidbritch commented 3 years ago

Yes. I'm just looking at it purely from a perspective of usage in MAUI.

charlesroddie commented 3 years ago

Post in https://github.com/dotnet/maui instead? The similarity in naming of the repos is unfortunate!