write_gif.c
来自「CA仿真模型中SLEUTH模型」· C语言 代码 · 共 34 行
C
34 行
#include <stdio.h>#include "gd.h"void write_gif (image, nrows, ncols){ FILE *out; int white, out; /* output image */ gdImagePtr im_out; /* Create output image. */ im_out = gdImageCreate(nrow, ncols); im_out->sx = ncols; im_out->sy = nrows; for (j=0;j<ncols;j++) { for (i=0;i<nrows;i++) { im->pixels[j] = (unsigned char) image[i][j]; }} out = fopen("image.gif", "wb"); /* Write GIF */ GIFEncode(im_out, ncols, nrows, int GInterlace, int Background, int Transparent, 16, int *Red, int *Green, int *Blue, gdImagePtr im) gdImageGif(im_out, out); fclose(out); gdImageDestroy(im_out); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?