/// <inheritdoc/> public bool TryWrite(Lazy <Stream> stream, CodecFormat format, SpanBitmap bmp) { using (var mat = bmp.WithOpenCv().ToMat()) { mat.WriteToStream(stream.Value, $".{format.ToString().ToLower()}"); } return(true); }
/// <inheritdoc/> public bool TryWrite(Lazy <Stream> stream, CodecFormat format, SpanBitmap bmp) { var fmt = SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.FindFormatByFileExtension(format.ToString().ToLower()); if (fmt == null) { return(false); } var encoder = SixLabors.ImageSharp.Configuration.Default.ImageFormatsManager.FindEncoder(fmt); if (encoder == null) { return(false); } using (var img = _Implementation.CloneToImageSharp(bmp)) { img.Save(stream.Value, encoder); } return(true); }