其他分享
首页 > 其他分享> > dxCameraControl抓拍并压缩jpeg

dxCameraControl抓拍并压缩jpeg

作者:互联网

//由于dxCameraControl 直接拍照图片保存普遍比较大,大约3M左右,故需要压缩
procedure TFormMain.capturePic(tmpStr: string); var filePathName: string; JPEGImage: TJPEGImage; begin if Trim(spath) <> '' then begin if not DirectoryExists(spath) then begin ForceDirectories(spath); end; filePathName := spath + tmpStr+ '.jpg'; // dxCameraControl1.CapturedBitmap.CompressData := True; dxCameraControl1.Capture; // dxCameraControl1.CapturedBitmap.Height := 600; // dxCameraControl1.CapturedBitmap.Width := 800; cxImage1.Picture.Assign(dxCameraControl1.CapturedBitmap); cxImage1.Picture.SaveToFile(filePathName); JPEGImage := TJPEGImage.Create; JPEGImage.Assign(cxImage1.Picture.Graphic); JPEGImage.CompressionQuality := 25; JPEGImage.Compress; JPEGImage.SaveToFile(filePathName); end; end;

 

标签:begin,spath,filePathName,JPEGImage,dxCameraControl,dxCameraControl1,jpeg,抓拍,Capt
来源: https://www.cnblogs.com/yangxuming/p/14868406.html