How do I get a stream or byte[] from a MauiImage?

Paul Mariotti 6 Reputation points

I am developing a multiplatform app using NetMaui.
I have a large number of image files in the /Resources/Images folder, and all of the files have a build type of MauiImage.
I have no problem getting the images displayed on phone screens in the proper resolution and size, but I also need to use (as input to an installed library) these files as either a Steam or a byte[].
This would be very easy if the files had a build type of EmbeddedResource, but I cannot find any way to convert them to stream or byte[] if I keep the build type as MauiImage.
It would be impossible to duplicate the files as EmbeddedResources since this would make the app extremely large.
Does anybody out there know how this problem cold be solved?

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
1,407 questions
{count} vote