Leptonica 1.68
C Image Processing Library

convertfilestops.c

Go to the documentation of this file.
00001 /*====================================================================*
00002  -  Copyright (C) 2001 Leptonica.  All rights reserved.
00003  -  This software is distributed in the hope that it will be
00004  -  useful, but with NO WARRANTY OF ANY KIND.
00005  -  No author or distributor accepts responsibility to anyone for the
00006  -  consequences of using this software, or for whether it serves any
00007  -  particular purpose or works at all, unless he or she says so in
00008  -  writing.  Everyone is granted permission to copy, modify and
00009  -  redistribute this source code, for commercial or non-commercial
00010  -  purposes, with the following restrictions: (1) the origin of this
00011  -  source code must not be misrepresented; (2) modified versions must
00012  -  be plainly marked as such; and (3) this notice may not be removed
00013  -  or altered from any source or modified source distribution.
00014  *====================================================================*/
00015 
00016 /*
00017  * convertfilestops.c
00018  *
00019  *    Converts all files in the given directory with matching substring
00020  *    to a level 3 compressed PostScript file, at the specified resolution.
00021  *    To convert all files in the directory, use 'allfiles' for the substring.
00022  *
00023  *    See below for syntax and usage.
00024  *
00025  *    To generate a ps that scales the images to fit a standard 8.5 x 11
00026  *    page, use res = 0.
00027  *
00028  *    Otherwise, this will convert based on a specified input resolution.
00029  *    Decreasing the input resolution will cause the image to be rendered
00030  *    larger, and v.v.   For example, if the page was originally scanned
00031  *    at 400 ppi and you use 300 ppi for the resolution, the page will
00032  *    be rendered with larger pixels (i.e., be magnified) and you will
00033  *    lose a quarter of the page on the right side and a quarter
00034  *    at the bottom.
00035  */
00036 
00037 #include <string.h>
00038 #include "allheaders.h"
00039 
00040 main(int    argc,
00041      char **argv)
00042 {
00043 char           *dirin, *substr, *fileout;
00044 l_int32         res;
00045 
00046 
00047     if (argc != 5) {
00048         fprintf(stderr,
00049             " Syntax: convertfilestops dirin substr res fileout\n"
00050             "     where\n"
00051             "         dirin:  input directory for image files\n"
00052             "         substr:  Use 'allfiles' to convert all files\n"
00053             "                  in the directory.\n"
00054             "         res:  Input resolution of each image;\n"
00055             "               assumed to all be the same\n"
00056             "         fileout:  Output ps file.\n");
00057         return 1;
00058     }
00059 
00060     dirin = argv[1];
00061     substr = argv[2];
00062     res = atoi(argv[3]);
00063     fileout = argv[4];
00064     if (!strcmp(substr, "allfiles"))
00065         substr = NULL;
00066     if (res != 0)
00067         return convertFilesToPS(dirin, substr, res, fileout);
00068     else
00069         return convertFilesFittedToPS(dirin, substr, 0.0, 0.0, fileout);
00070 }
00071 
00072 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines