1998.07.09 15:24 "Re: tiffsplit in a cronjob", by Bjorn Brox
Humzah Jaffar wrote this:
i have a cronjob running every morning using the tiffsplit command (from tifflib on DEC unix) to count the number of files in several 100 multi-page tiffs that are transferred into our storage. then i count the number of "xfiles" formed.
problem: i always get a count of 0. however when i run the same cronjob manually on the exact same files, it splits the files and counts the xfiles accurately. any ideas why? or is there a more efficient way to figure out how many files are in a multipage tiff?
You probably get zero because the current directory or user rights is different from what is used when executing it manually.
Why don't you just write a small program using libtiff, like this one:
----tiff_imagecount.c----
#include <stdlib.h>
#include "tiffio.h"
void main(int argc, char *argv[])
{
TIFF *tif;
if (argc != 2 || !(tif = TIFFOpen(argv[1], "r"))) {
(void)fprintf(stderr, "USAGE: %s image.tif\n", argv[0]);
exit(1);
}
(void)printf("%hu\n", TIFFNumberOfDirectories(tif));
TIFFClose(tif);
exit(0);
}
----
--
Bjorn Brox, mailto:brox@corena.no, CORENA A/S, http://www.corena.no/
P.O.Box 1024, Kongsberg Naeringspark, N-3601 Kongsberg, NORWAY
Phone: +47 32737435, Fax: +47 32736877, Mobile: +47 92638590