// Output the data // out = fopen(outfile, "wb"); gdImagePngEx(img, out, -1); // Close things up // fclose(out); gdImageDestroy(img); return(0); }