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;

 

posted @ 2021-06-09 19:50  夏天的西瓜君  阅读(226)  评论(0编辑  收藏  举报