diff --git a/app/scanner/mainwindow.cpp b/app/scanner/mainwindow.cpp index 8c1b6dfd..689c3518 100644 --- a/app/scanner/mainwindow.cpp +++ b/app/scanner/mainwindow.cpp @@ -2537,6 +2537,8 @@ void MainWindow::on_act_autoCrop_triggered() int indent = dlg.getIndent(); HGImgAutoCropParam autoCropParam; + autoCropParam.normalCrop = HGFALSE; + autoCropParam.dispersion = HGTRUE; if (isFillBlank) { @@ -2562,20 +2564,26 @@ void MainWindow::on_act_autoCrop_triggered() autoCropParam.indent = 5; } - HGImageInfo imgInfo; - HGBase_GetImageInfo(img, &imgInfo); - - HGImage destImage = nullptr; - HGImgProc_ImageAutoCrop(img, (HGBool)isCrop, (HGBool)isDeskew, (HGBool)isFillBlank, &autoCropParam, imgInfo.width, imgInfo.height, - imgInfo.type, HGBASE_IMGORIGIN_TOP, &destImage); - if (nullptr != destImage) + if (isCrop || isDeskew || isFillBlank) { - m_view->addImage(destImage); - HGBase_DestroyImage(destImage); - m_modify = true; + HGImageInfo imgInfo; + HGBase_GetImageInfo(img, &imgInfo); - updateStatusBarPixelInfo(); - updateActionStatus(); + HGImage destImage = nullptr; + HGUInt destWidth = imgInfo.width; + HGUInt destHeight = imgInfo.height; + + HGImgProc_ImageAutoCrop(img, (HGBool)isCrop, (HGBool)isDeskew, (HGBool)isFillBlank, &autoCropParam, destWidth, destHeight, + imgInfo.type, HGBASE_IMGORIGIN_TOP, &destImage); + if (nullptr != destImage) + { + m_view->addImage(destImage); + HGBase_DestroyImage(destImage); + m_modify = true; + + updateStatusBarPixelInfo(); + updateActionStatus(); + } } } }