I am using Xamarin Forms 4.1 (android and ios) and am trying to load an image (png) from the respective asset folders (i.e. resources/drawable on android) into an SKBitmap.
I can load with no problem from the shared folder, (like so)
Assembly assembly = GetType().GetTypeInfo().Assembly;
string resourceID = "PROJECTNAME.Images.image.png";
using (Stream stream = assembly.GetManifestResourceStream(resourceID))
{
SKBitmapObj = SKBitmap.Decode(stream);
}
but would like to do so from the platform folders as the images are used in XAML elsewhere as well.
I have attempted to first load the image into an FFImageLoading CachedImage, and then get the bytes to decode into the SKBitmap, but likewise I seem unable to load a platform image in code.
FFImageLoading.Forms.CachedImage cachedImage =
new CachedImage() { Source = "imagename" };
SKBitampObj = SKBitmap.Decode(cachedImage.GetImageAsPngAsync(60, 60).result);
CachedImages display fine when I do so in XAML, so I assume I am just addressing the image incorrectly, but am not sure.