Leptonica 1.68
C Image Processing Library

convertfiles.c File Reference

Perform depth conversion on selected files. More...

#include <string.h>
#include "allheaders.h"

Go to the source code of this file.


l_int32 convertFilesTo1bpp (const char *dirin, const char *substr, l_int32 upscaling, l_int32 thresh, l_int32 firstpage, l_int32 npages, const char *dirout, l_int32 outformat)

Detailed Description

Perform depth conversion on selected files.

    Conversion to 1 bpp
        l_int32    convertFilesTo1bpp()

These are utility functions that will perform depth conversion
on selected files, writing the results to a specified directory.
We start with conversion to 1 bpp.

Definition in file convertfiles.c.

Function Documentation

l_int32 convertFilesTo1bpp ( const char *  dirin,
const char *  substr,
l_int32  upscaling,
l_int32  thresh,
l_int32  firstpage,
l_int32  npages,
const char *  dirout,
l_int32  outformat 


Input: dirin substr (<optional> substring filter on filenames; can be NULL) upscaling (1, 2 or 4; only for input color or grayscale) thresh (global threshold for binarization; use 0 for default) firstpage npages (use 0 to do all from to the end) dirout outformat (IFF_PNG, IFF_TIFF_G4) Return: 0 if OK, 1 on error

Notes: (1) Images are sorted lexicographically, and the names in the output directory are retained except for the extension.

Definition at line 52 of file convertfiles.c.

References buf, ERROR_INT, FREE, getSortedPathnamesInDirectory(), IFF_PNG, IFF_TIFF_G4, L_NOCOPY, L_WARNING_STRING, nfiles, NULL, pixClone(), pixConvertRGBToLuminance(), pixDestroy(), pixGetDepth(), pixRead(), pixRemoveColormap(), pixScaleGray2xLIThresh(), pixScaleGray4xLIThresh(), pixThresholdToBinary(), pixWrite(), PROCNAME, REMOVE_CMAP_TO_GRAYSCALE, sarrayDestroy(), sarrayGetCount(), sarrayGetString(), splitPathAtDirectory(), and splitPathAtExtension().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines