public static void WriteImageTo(this Frame frame, Stream stream, OutputFormat?format = null, string?formatName = null, bool leaveOpen = false)
        {
            using FormatContext fc = FormatContext.AllocOutput(format, formatName);
            using var io           = MediaIO.WriteStream(stream);
            fc.IO = io;

            WriteImageTo(frame, fc);
            if (!leaveOpen)
            {
                stream.Close();
            }
        }