0

I have a DotNet Core 7 app, which utilises the rather wonderful FFMpegCore by Malte Rosenbjerg to get snapshots of video using FFMpeg. I'm converting my app to run on Linux, but the FFMpeg.Snapshot function returns a System.Drawing.Bitmap, and the only way I can find to Save() it to a stream comes with a warning:

This call site is reachable on all platforms. 'Image.Save(Stream, ImageFormat)' is supported only on 'windows'

I'm using ImageSharp for other graphic manipulations, and it feels like the right thing to do is use that to read the in-memory bitmap and save it down to a stream, but I can't get it to load the resulting Bitmap.

The code is simply:

(await FFMpeg.SnapshotAsync(responseFile,
   new System.Drawing.Size(100, 100),
   TimeSpan.FromSeconds(frameSecond)))
   .Save(stream, System.Drawing.Imaging.ImageFormat.Png);

What is the best way to return my bitmap as a stream without running on Windows?

I've also tried ImageConverter (windows-only), and various Image.Load(...) and Image.LoadPixelData as mentioned here

Dunc
  • 31
  • 6

0 Answers0