#include <stdio.h>#include "gd.h"Go to the source code of this file.
Functions | |
| int | main (int argc, char **argv) |
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
Definition at line 9 of file giftogd.cpp.
References gdImageCreateFromGif(), gdImageDestroy(), and gdImageGd().
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 }
1.5.1