/// <summary> /// 抓图 /// </summary> /// <param name="CH">通道</param> /// <param name="Quality">质量</param> /// <param name="Size"> /// 0=CIF, 1=QCIF, 2=D1 3=UXGA(1600x1200), 4=SVGA(800x600), 5=HD720p(1280x720),6=VGA /// IPCAM专用{3=UXGA(1600x1200), 4=SVGA(800x600), 5=HD720p(1280x720),6=VGA(640x480) , 7=XVGA, 8=HD900p /// </param> /// <returns></returns> public Image CaptureJPG(int CH, ushort Quality = 2, ushort Size = 0xff) { bool res = false; NET_DVR_JPEGPARA jpeginfo; jpeginfo.wPicQuality = Quality; jpeginfo.wPicSize = Size; byte[] data = new byte[this.BufferSize]; uint ret = 0; if (Environment.Is64BitProcess) { res = HCNetSDKia64.NET_DVR_CaptureJPEGPicture_NEW(this.lUserID, CH, ref jpeginfo, data, (uint)data.Length, out ret); } else { res = HCNetSDK.NET_DVR_CaptureJPEGPicture_NEW(this.lUserID, CH, jpeginfo, data, (uint)data.Length, out ret); } if (!res) { Error(); } MemoryStream ms = new MemoryStream(data); Image image = System.Drawing.Image.FromStream(ms); ms.Close(); ms.Dispose(); ms = null; System.GC.Collect(); return(image); }