00001 #include <stdio.h>
00002 #include "gd.h"
00003
00004
00005
00006
00007
00008
00009 int main(int argc, char **argv)
00010 {
00011 gdImagePtr im;
00012 FILE *in, *out;
00013 if (argc != 3) {
00014 fprintf(stderr, "Usage: giftogd filename.gif filename.gd\n");
00015 exit(1);
00016 }
00017 in = fopen(argv[1], "rb");
00018 if (!in) {
00019 fprintf(stderr, "Input file does not exist!\n");
00020 exit(1);
00021 }
00022 im = gdImageCreateFromGif(in);
00023 fclose(in);
00024 if (!im) {
00025 fprintf(stderr, "Input is not in GIF format!\n");
00026 exit(1);
00027 }
00028 out = fopen(argv[2], "wb");
00029 if (!out) {
00030 fprintf(stderr, "Output file cannot be written to!\n");
00031 gdImageDestroy(im);
00032 exit(1);
00033 }
00034 gdImageGd(im, out);
00035 fclose(out);
00036 gdImageDestroy(im);
00037 }
00038