3
#include <stdlib.h> /* for atoi */
4
#include <time.h> /* For time */
7
/* A short program which converts a .png file into a .gd file, for
8
your convenience in creating images on the fly from a
9
basis image that must be loaded quickly. The .gd format
10
is not intended to be a general-purpose format. */
13
main (int argc, char **argv)
24
fprintf (stderr, "Usage: gd2time filename.gd count x y w h\n");
34
printf ("Extracting %d times from (%d, %d), size is %dx%d\n", c, x, y, w, h);
37
for (i = 0; i < c; i++)
39
in = fopen (argv[1], "rb");
42
fprintf (stderr, "Input file does not exist!\n");
46
im = gdImageCreateFromGd2Part (in, x, y, w, h);
51
fprintf (stderr, "Error reading source file!\n");
57
printf ("%d seconds to extract (& destroy) %d times\n", t0, c);