diff --git a/prog/2_column_crop_input.pdf b/prog/2_column_crop_input.pdf new file mode 100644 index 000000000..9086c5888 Binary files /dev/null and b/prog/2_column_crop_input.pdf differ diff --git a/prog/compresspdf.c b/prog/compresspdf.c index 84639290a..eb47f303b 100644 --- a/prog/compresspdf.c +++ b/prog/compresspdf.c @@ -87,8 +87,8 @@ * required) to have a '.pdf' extension. * * As the first step in processing, images are saved in the directory - * /tmp/lept/renderpdf/, as RGB at 300 ppi in ppm format. Each image - * is about 26MB. + * /tmp/lept/renderpdf/, as RGB at either 150 or 300 ppi in ppm format. + * Each image about 6MB at 150 ppi, or 25MB at 300 ppi. * * We use pdftoppm to render the images at (typically) 150 pixels/inch * for a full page, when scalefactor = 1.0. The renderer uses the diff --git a/prog/croppdf.c b/prog/croppdf.c index 158a8e2cc..7891ff4e0 100644 --- a/prog/croppdf.c +++ b/prog/croppdf.c @@ -78,7 +78,7 @@ * The pdf output is written to %fileout. It is advisable (but not * required) to have a '.pdf' extension. * - * The first processing step is render images from the pdf as $GB + * The first processing step is render images from the pdf as RGB * at 300 ppi in ppm format, and to seve them in the directory * /tmp/lept/renderpdf/. * diff --git a/prog/misctest2.c b/prog/misctest2.c index 8e58b6327..a4db2d99e 100644 --- a/prog/misctest2.c +++ b/prog/misctest2.c @@ -29,6 +29,8 @@ * * Page cropping with light filtering * * Page cropping with removal of fg on left and right sides * * Demonstrate image cleaning function + * * Demonstrat page cropping for 2-column, where one column is + * Kanji, and removing lots of junk on left and right sides. */ #ifdef HAVE_CONFIG_H @@ -40,6 +42,7 @@ int main(int argc, char **argv) { +char buf[256]; PIX *pix1, *pix2, *pix3; PIXA *pixa1; @@ -67,6 +70,21 @@ PIXA *pixa1; pixDestroy(&pix1); pixDestroy(&pix2); + /* Page cropping for 2 columns with junk on left and right sides, + * This is the 2-column introductory material from Bruggen's + * transcription of Bach's Cello Suites 1-3. The right column + * is kanji, which is relatively weak for coalescing into + * connected blocks. So it is necessary to include a + * horizontal close/open of size 3, and in the algorithm, the + * vertical close/open needs to be at least 70 at 4x reduction. */ + lept_mkdir("lept/2_column"); + lept_cp("2_column_crop_input.pdf", "lept/2_column", "input.pdf", NULL); + snprintf(buf, sizeof(buf), + "croppdf /tmp/lept/2_column 50 50 -1 70 70 1.12 0" + " none /tmp/lept/misc/2_column_crop_result.pdf"); + lept_stderr("Writing /tmp/lept/misc/2_column_crop_result.pdf\n"); + callSystemDebug(buf); + /* Page cleaning */ pixa1 = pixaCreate(3); pix1 = pixRead("tel_3.tif");