diff options
Diffstat (limited to 'UVtools.Core/Extensions/EmguExtensions.cs')
-rw-r--r-- | UVtools.Core/Extensions/EmguExtensions.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs index 2806e43..2631597 100644 --- a/UVtools.Core/Extensions/EmguExtensions.cs +++ b/UVtools.Core/Extensions/EmguExtensions.cs @@ -13,6 +13,7 @@ using System.Runtime.InteropServices; using Emgu.CV; using Emgu.CV.CvEnum; using Emgu.CV.Structure; +using Emgu.CV.Util; namespace UVtools.Core.Extensions { @@ -333,5 +334,12 @@ namespace UVtools.Core.Extensions return layers; } + public static byte[] GetPngByes(this Mat mat) + { + using var vector = new VectorOfByte(); + CvInvoke.Imencode(".png", mat, vector); + return vector.ToArray(); + } + } } |