littleutils  1.2.5
About: littleutils are a collection of small and simple utilities (rename files, search for duplicate files, ...).
  Fossies Dox: littleutils-1.2.5.tar.lz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

imagsize.c File Reference
#include <config.h>
#include <limits.h>
Include dependency graph for imagsize.c:

Go to the source code of this file.

Macros

#define OPTEND   EOF
 
#define PATH_MAX   256
 
#define M_SOF   0xc0
 
#define M_SOI   0xd8
 
#define M_EOI   0xd9
 
#define M_SOS   0xda
 
#define M_DQT   0xdb
 
#define NOT_OK   0
 
#define OK   1
 

Functions

static void help (FILE *where)
 
static int failure (char *reason)
 
static int get (FILE *f, unsigned char *chP)
 
static int mustbe (FILE *f, unsigned char ch)
 
static int gif (FILE *f, int *widthP, int *heightP, int *depth)
 
static int bmp (FILE *f, int *widthP, int *heightP, int *depth)
 
static int jpeg (FILE *f, int *widthP, int *heightP, double *qual, int *depth, int *typenum, char *sampling)
 
static int xbm (FILE *f, int *widthP, int *heightP)
 
static int xpm (FILE *f, int *widthP, int *heightP, int *depth)
 
static int ppm (FILE *f, int *widthP, int *heightP)
 
static int png (FILE *f, int *widthP, int *heightP, int *bpp, int *typenum)
 
static int tiff_be (FILE *f, int *widthP, int *heightP, int *depth)
 
static int tiff_le (FILE *f, int *widthP, int *heightP, int *depth)
 
static int image_size (FILE *f, int *widthP, int *heightP, double *qual, int *depth, char *type, char *sample)
 
static int print_size (char *filename, int format, int verbose)
 
int main (int argc, char **argv)
 

Variables

char * fmt0
 
char * fmt1
 
char * fmt2 = "<img src=\"%s\" alt=\"%s\" width=\"%d\" height=\"%d\">\n"
 
char * fmt0a
 
char * fmt1a
 
char * fmt2a = "<img src=\"%s\" alt=\"%s\" width=\"0\" height=\"0\">\n"
 
static int std_luminance_quant_tbl [64]
 
static int std_chrominance_quant_tbl [64]
 
static int * deftabs [2]
 
static char errstr [200]
 

Macro Definition Documentation

◆ M_DQT

#define M_DQT   0xdb

Definition at line 91 of file imagsize.c.

◆ M_EOI

#define M_EOI   0xd9

Definition at line 89 of file imagsize.c.

◆ M_SOF

#define M_SOF   0xc0

Definition at line 87 of file imagsize.c.

◆ M_SOI

#define M_SOI   0xd8

Definition at line 88 of file imagsize.c.

◆ M_SOS

#define M_SOS   0xda

Definition at line 90 of file imagsize.c.

◆ NOT_OK

#define NOT_OK   0

Definition at line 95 of file imagsize.c.

◆ OK

#define OK   1

Definition at line 96 of file imagsize.c.

◆ OPTEND

#define OPTEND   EOF

Definition at line 65 of file imagsize.c.

◆ PATH_MAX

#define PATH_MAX   256

Definition at line 82 of file imagsize.c.

Function Documentation

◆ bmp()

static int bmp ( FILE *  f,
int *  widthP,
int *  heightP,
int *  depth 
)
static

Definition at line 243 of file imagsize.c.

References get(), NOT_OK, and OK.

Referenced by image_size().

◆ failure()

static int failure ( char *  reason)
static

Definition at line 178 of file imagsize.c.

References errstr, and NOT_OK.

Referenced by get(), gif(), image_size(), jpeg(), mustbe(), png(), ppm(), xbm(), and xpm().

◆ get()

static int get ( FILE *  f,
unsigned char *  chP 
)
static

Definition at line 186 of file imagsize.c.

References failure(), and OK.

Referenced by bmp(), gif(), image_size(), jpeg(), mustbe(), png(), tiff_be(), and tiff_le().

◆ gif()

static int gif ( FILE *  f,
int *  widthP,
int *  heightP,
int *  depth 
)
static

Definition at line 215 of file imagsize.c.

References failure(), get(), mustbe(), NOT_OK, and OK.

Referenced by image_size().

◆ help()

static void help ( FILE *  where)
static

Definition at line 168 of file imagsize.c.

Referenced by main().

◆ image_size()

static int image_size ( FILE *  f,
int *  widthP,
int *  heightP,
double *  qual,
int *  depth,
char *  type,
char *  sample 
)
static

Definition at line 776 of file imagsize.c.

References bmp(), failure(), get(), gif(), jpeg(), M_SOI, NOT_OK, png(), ppm(), tiff_be(), tiff_le(), type, xbm(), and xpm().

Referenced by print_size().

◆ jpeg()

static int jpeg ( FILE *  f,
int *  widthP,
int *  heightP,
double *  qual,
int *  depth,
int *  typenum,
char *  sampling 
)
static

Definition at line 298 of file imagsize.c.

References deftabs, failure(), get(), M_DQT, M_SOF, mustbe(), NOT_OK, and OK.

Referenced by image_size().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 968 of file imagsize.c.

References help(), infile, OPTEND, PATH_MAX, print_size(), and verbose.

◆ mustbe()

static int mustbe ( FILE *  f,
unsigned char  ch 
)
static

Definition at line 197 of file imagsize.c.

References failure(), get(), NOT_OK, and OK.

Referenced by gif(), jpeg(), png(), tiff_be(), tiff_le(), and xpm().

◆ png()

static int png ( FILE *  f,
int *  widthP,
int *  heightP,
int *  bpp,
int *  typenum 
)
static

Definition at line 716 of file imagsize.c.

References failure(), get(), mustbe(), NOT_OK, and OK.

Referenced by image_size().

◆ ppm()

static int ppm ( FILE *  f,
int *  widthP,
int *  heightP 
)
static

Definition at line 507 of file imagsize.c.

References failure(), and OK.

Referenced by image_size().

◆ print_size()

static int print_size ( char *  filename,
int  format,
int  verbose 
)
static

Definition at line 906 of file imagsize.c.

References errstr, fmt0, fmt0a, fmt1, fmt1a, fmt2, fmt2a, image_size(), NOT_OK, OK, type, and verbose.

Referenced by main(), and print_filehash().

◆ tiff_be()

static int tiff_be ( FILE *  f,
int *  widthP,
int *  heightP,
int *  depth 
)
static

Definition at line 530 of file imagsize.c.

References get(), mustbe(), NOT_OK, OK, and type.

Referenced by image_size().

◆ tiff_le()

static int tiff_le ( FILE *  f,
int *  widthP,
int *  heightP,
int *  depth 
)
static

Definition at line 623 of file imagsize.c.

References get(), mustbe(), NOT_OK, OK, and type.

Referenced by image_size().

◆ xbm()

static int xbm ( FILE *  f,
int *  widthP,
int *  heightP 
)
static

Definition at line 446 of file imagsize.c.

References failure(), and OK.

Referenced by image_size().

◆ xpm()

static int xpm ( FILE *  f,
int *  widthP,
int *  heightP,
int *  depth 
)
static

Definition at line 465 of file imagsize.c.

References failure(), mustbe(), NOT_OK, and OK.

Referenced by image_size().

Variable Documentation

◆ deftabs

int* deftabs[2]
static
Initial value:
=
static int std_luminance_quant_tbl[64]
Definition: imagsize.c:117
static int std_chrominance_quant_tbl[64]
Definition: imagsize.c:128

Definition at line 139 of file imagsize.c.

Referenced by jpeg().

◆ errstr

char errstr[200]
static

Definition at line 144 of file imagsize.c.

Referenced by failure(), and print_size().

◆ fmt0

char* fmt0
Initial value:
= (sizeof (off_t) <= sizeof (long) ?
"%s\tsize=%lu\tgeom=%dx%d\tdepth=%d\tqual=%.0f,%.0f\tsamp=%s\ttype=%s\n" :
"%s\tsize=%llu\tgeom=%dx%d\tdepth=%d\tqual=%.0f,%.0f\tsamp=%s\ttype=%s\n")

Definition at line 98 of file imagsize.c.

Referenced by print_size().

◆ fmt0a

char* fmt0a
Initial value:
= (sizeof (off_t) <= sizeof (long) ?
"%s\tsize=%lu\tgeom=0x0\tdepth=0\tqual=0,0\tsamp=none\ttype=%s\n" :
"%s\tsize=%llu\tgeom=0x0\tdepth=0\tqual=0,0\tsamp=none\ttype=%s\n")

Definition at line 105 of file imagsize.c.

Referenced by print_size().

◆ fmt1

char* fmt1
Initial value:
= (sizeof (off_t) <= sizeof (long) ?
"-name %s -size %lu -geometry %dx%d -bitdepth %d -quality %.0f,%.0f -sampling %s -type %s\n" :
"-name %s -size %llu -geometry %dx%d -bitdepth %d -quality %.0f,%.0f -sampling %s -type %s\n")

Definition at line 101 of file imagsize.c.

Referenced by print_size().

◆ fmt1a

char* fmt1a
Initial value:
= (sizeof (off_t) <= sizeof (long) ?
"-name %s -size %lu -geometry 0x0 -bitdepth 0 -quality 0,0 -sampling=none -type %s\n" :
"-name %s -size %llu -geometry 0x0 -bitdepth 0 -quality 0,0 -sampling=none -type %s\n")

Definition at line 108 of file imagsize.c.

Referenced by print_size().

◆ fmt2

char* fmt2 = "<img src=\"%s\" alt=\"%s\" width=\"%d\" height=\"%d\">\n"

Definition at line 104 of file imagsize.c.

Referenced by print_size().

◆ fmt2a

char* fmt2a = "<img src=\"%s\" alt=\"%s\" width=\"0\" height=\"0\">\n"

Definition at line 111 of file imagsize.c.

Referenced by print_size().

◆ std_chrominance_quant_tbl

int std_chrominance_quant_tbl[64]
static
Initial value:
= {
17, 18, 18, 24, 21, 24, 47, 26,
26, 47, 99, 66, 56, 66, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99
}

Definition at line 128 of file imagsize.c.

◆ std_luminance_quant_tbl

int std_luminance_quant_tbl[64]
static
Initial value:
= {
16, 11, 12, 14, 12, 10, 16, 14,
13, 14, 18, 17, 16, 19, 24, 40,
26, 24, 22, 22, 24, 49, 35, 37,
29, 40, 58, 51, 61, 60, 57, 51,
56, 55, 64, 72, 92, 78, 64, 68,
87, 69, 55, 56, 80, 109, 81, 87,
95, 98, 103, 104, 103, 62, 77, 113,
121, 112, 100, 120, 92, 101, 103, 99
}

Definition at line 117 of file imagsize.c.