Exemple #1
0
        public string Capture2Base64()
        {
            //图片保存路径和文件名 the path and file name to save
            string PictureFileName = Helper.UniqueFile(SaveFileType.Picture, FileExtensionType.bmp);

            bool isCapture = XMNetSDK.H264_PLAY_CatchPic(VideoInfo.Channel, PictureFileName, 0);

            if (!isCapture)
            {
                int nErr = XMNetSDK.H264_DVR_GetLastError();
                throw new Exception("[雄迈]截图失败:" + nErr);
            }

            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));
            }
        }
Exemple #2
0
        public string Capture2Image()
        {
            //图片保存路径和文件名 the path and file name to save
            string PictureFileName = Helper.UniqueFile(SaveFileType.Picture, FileExtensionType.bmp);

            bool isCapture = XMNetSDK.H264_PLAY_CatchPic(VideoInfo.Channel, PictureFileName, 0);

            if (!isCapture)
            {
                int nErr = XMNetSDK.H264_DVR_GetLastError();
                throw new Exception("[雄迈]截图失败:" + nErr);
            }
            return(PictureFileName);
        }