public string Capture2Image() { //图片保存路径和文件名 the path and file name to save string PictureFileName = Helper.UniqueFile(SaveFileType.Picture, FileExtensionType.bmp); int lChannel = VideoInfo.Channel; //通道号 Channel number if (!XSJNetSDK.NET_SDK_CapturePicture(realHandle, PictureFileName)) { throw new Exception("[兴视捷]截图失败:" + GetErrorMessage()); } return(PictureFileName); }
public string Capture2Base64() { //图片保存路径和文件名 the path and file name to save string PictureFileName = Helper.UniqueFile(SaveFileType.Picture, FileExtensionType.bmp); int lChannel = VideoInfo.Channel; //通道号 Channel number if (!XSJNetSDK.NET_SDK_CapturePicture(realHandle, PictureFileName)) { throw new Exception("[兴视捷]截图失败:" + GetErrorMessage()); } Bitmap bmp = new Bitmap(PictureFileName); using (MemoryStream ms1 = new MemoryStream()) { bmp.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] arr1 = new byte[ms1.Length]; ms1.Position = 0; ms1.Read(arr1, 0, (int)ms1.Length); ms1.Close(); return(Convert.ToBase64String(arr1)); } }