15 #include "imageInfo.h" 16 #include "pnmImageHeader.h" 26 set_program_brief(
"report the size of image files");
27 set_program_description
28 (
"This program reads the headers of a series of one or more " 29 "image files and reports the image sizes to standard output.");
33 "Report only images that have a non-power-of-two size in either " 34 "dimension. Images whose dimensions are both a power of two will " 36 &ImageInfo::dispatch_none, &_report_power_2, NULL);
46 Args::const_iterator ai;
47 for (ai = _filenames.begin(); ai != _filenames.end(); ++ai) {
53 nout << filename <<
": could not read image.\n";
55 nout << filename <<
": does not exist.\n";
59 if (!_report_power_2 ||
62 nout << filename <<
": " << header.
get_x_size() <<
" x " 64 <<
" (maxval = " << header.
get_maxval() <<
")\n";
81 nout <<
"List one or more image filenames on command line.\n";
96 is_power_2(
int value)
const {
97 return (value & (value - 1)) == 0;
101 int main(
int argc,
char *argv[]) {
virtual void parse_command_line(int argc, char **argv)
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_...
The name of a file, such as a texture file or an Egg file.
This program reads the headers of a series of one or more images and reports their sizes to standard ...
bool exists() const
Returns true if the filename exists on the disk, false otherwise.