You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to convert How to convert ImageData to SkiaSharp.SkiBitmap by using SKBitmap.Decode(imageData.Data, new SKImageInfo { Height = imageData.ImageSize.Height, Width = imageData.ImageSize.Width }), but it keep failing.
Does anyone know how to convert ImageData to SkiBitmap?
The text was updated successfully, but these errors were encountered:
Here is example. It's is not optimized, but should work.
usingSystem.Runtime.InteropServices;usingFFMediaToolkit.Decoding;usingFFMediaToolkit.Graphics;usingSkiaSharp;varfile=MediaFile.Open(@"/path/to/file.mp4",newMediaOptions{VideoPixelFormat=ImagePixelFormat.Rgba32// Set skia supported pix format});if(file.Video.TryGetNextFrame(outvarimageData)){vargcHandle=GCHandle.Alloc(imageData.Data.ToArray(),GCHandleType.Pinned);usingvarbitmap=newSKBitmap();varimageInfo=newSKImageInfo(imageData.ImageSize.Width,imageData.ImageSize.Height,SKColorType.Rgba8888,SKAlphaType.Unpremul);bitmap.InstallPixels(imageInfo,gcHandle.AddrOfPinnedObject(),imageInfo.RowBytes,delegate{gcHandle.Free();});// Save to fileusingvarfs=File.OpenWrite(@"/path/to/image.png");bitmap.Encode(fs,SKEncodedImageFormat.Png,100);}
Try to convert How to convert ImageData to SkiaSharp.SkiBitmap by using SKBitmap.Decode(imageData.Data, new SKImageInfo { Height = imageData.ImageSize.Height, Width = imageData.ImageSize.Width }), but it keep failing.
Does anyone know how to convert ImageData to SkiBitmap?
The text was updated successfully, but these errors were encountered: