Skip to content

Commit

Permalink
Small changes in cleanpdf and croppdf
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBloomberg committed Oct 15, 2023
1 parent 5fd8349 commit af0c6a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions prog/cleanpdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@
*
* The %contrast parameter adjusts the binarization to avoid losing input
* details that are too light. It takes on 10 values from 1 to 10, where
* 1 is the lightest value and it removes noise. Suggested value is 1
* unless important details are lost on binarization.
* 1 is the lightest value and it removes noise. Use of 0 will default
* to 1. Suggested value is 1 unless important details are lost on
* binarization.
*
* The %rotation parameter is an integer that specifies the rotation
* to be applied to each image:
Expand Down Expand Up @@ -173,6 +174,7 @@ SARRAY *sa;
__func__, res);
return 1;
}
if (contrast == 0) contrast = 1;
if (contrast < 1 || contrast > 10) {
L_ERROR("invalid contrast = %d; contrast must be in {1,...,10}\n",
__func__, contrast);
Expand Down
5 changes: 5 additions & 0 deletions src/pageseg.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ pixCropImage(PIX *pixs,
char cmd[64];
l_int32 w, h, d, lrc, tbc, val;
l_int32 left, right, top, bot, leftfinal, rightfinal, topfinal, botfinal;
static l_int32 first_time = TRUE;
l_float32 hscale;
PIX *pix1, *pix2, *pix3;
PIXA *pixa1;
Expand Down Expand Up @@ -676,6 +677,10 @@ BOX *box1, *box2;
if (hscale > 1.0 && maxwiden > 1.0) {
hscale = L_MIN(hscale, maxwiden);
pix3 = pixScale(pix2, hscale, 1.0);
if (first_time == TRUE) {
lept_stderr("Widening page by factor %5.3f\n", hscale);
first_time = FALSE;
}
} else {
pix3 = pixClone(pix2);
}
Expand Down

0 comments on commit af0c6a8

Please sign in to comment.