//主摄像头合成拍照返回base64位 public String btnComposeMainBase64_Click(String file) { if (bOpenMain) { file = LocalPath + "\\" + file; //如果没有目录,则创建目录 String dir = Path.GetDirectoryName(file); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } GpySdImpl.LaSetCaptureMode(mainIndex, 1); //设置拍照模式为合成拍照模式 GpySdImpl.LaEnableAutoRotate(mainIndex, true); //开启自动纠偏 //SD.LaSetJpgQuality(mainIndex, 50); //设置压缩比, 第二个参数取值1-100 GpySdImpl.LaSetDPI(mainIndex, 350); if (File.Exists(file)) { File.Delete(file); } //String file = ("C:\\cde.jpg"); GpySdImpl.LaCapture(mainIndex, file); //Image Im = Image.FromFile(file); //Bitmap Bm = new Bitmap(Im); //MemoryStream m = new MemoryStream(); //Bm.Save(m, ImageFormat.Jpeg); ////String base64 = Convert.ToBase64String(m.GetBuffer()); ////String base64 = Convert.ToBase64String(m.ToArray()); //Im.Dispose(); //Bm.Dispose(); //String base64 = SD.LaCaptureBase64(mainIndex); //SD.AddImageItem(file);//显示 GpySdImpl.LaSetCaptureMode(mainIndex, 0); //设置拍照模式为正常拍照 GpySdImpl.LaEnableAutoRotate(mainIndex, false); //关闭自动纠偏 String base64 = btnConvertBase64_Click(file); return(base64); } else { return(null); } }
/// <summary> /// 主摄像头合成拍照 /// </summary> /// <param name="file"></param> public void btnComposeMain_Click(String file) { if (bOpenMain) { file = LocalPath + "\\" + file; //如果没有目录,则创建目录 String dir = Path.GetDirectoryName(file); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } GpySdImpl.LaSetCaptureMode(mainIndex, 1); //设置拍照模式为合成拍照模式 GpySdImpl.LaEnableAutoRotate(mainIndex, true); //开启自动纠偏 //GpySdImpl.LaSetJpgQuality(mainIndex, 50); //设置压缩比, 第二个参数取值1-100 GpySdImpl.LaSetDPI(mainIndex, 350); GpySdImpl.LaCapture(mainIndex, file); //GpySdImpl.AddImageItem(file);//显示 GpySdImpl.LaSetCaptureMode(mainIndex, 0); //设置拍照模式为正常拍照 GpySdImpl.LaEnableAutoRotate(mainIndex, false); //关闭自动纠偏 } }