2
#include <stdlib.h> /* For atoi */
5
/* A short program which converts a .png file into a .gd file, for
6
your convenience in creating images on the fly from a
7
basis image that must be loaded quickly. The .gd format
8
is not intended to be a general-purpose format. */
11
main (int argc, char **argv)
19
fprintf (stderr, "Usage: gdparttopng filename.gd filename.png x y w h\n");
22
in = fopen (argv[1], "rb");
25
fprintf (stderr, "Input file does not exist!\n");
34
printf ("Extracting from (%d, %d), size is %dx%d\n", x, y, w, h);
36
im = gdImageCreateFromGd2Part (in, x, y, w, h);
40
fprintf (stderr, "Input is not in PNG format!\n");
43
out = fopen (argv[2], "wb");
46
fprintf (stderr, "Output file cannot be written to!\n");
53
fprintf(stderr, "No PNG library support.\n");