This source file includes following definitions.
- main
1 #include <stdio.h>
2 #include "gd.h"
3
4
5
6
7
8
9 int
10 main (int argc, char **argv)
11 {
12 gdImagePtr im;
13 FILE *in, *out;
14 if (argc != 3)
15 {
16 fprintf (stderr, "Usage: gdtopng filename.gd filename.png\n");
17 exit (1);
18 }
19 in = fopen (argv[1], "rb");
20 if (!in)
21 {
22 fprintf (stderr, "Input file does not exist!\n");
23 exit (1);
24 }
25 im = gdImageCreateFromGd (in);
26 fclose (in);
27 if (!im)
28 {
29 fprintf (stderr, "Input is not in GD format!\n");
30 exit (1);
31 }
32 out = fopen (argv[2], "wb");
33 if (!out)
34 {
35 fprintf (stderr, "Output file cannot be written to!\n");
36 gdImageDestroy (im);
37 exit (1);
38 }
39 gdImagePng (im, out);
40 fclose (out);
41 gdImageDestroy (im);
42
43 return 0;
44 }