#include #include int main() { gdImagePtr oldtux, newtux; //declaration of the image pointers FILE *out, *in; int red,white; int brect[8]; char *err; in = fopen("tuxin.jpg","r"); oldtux = gdImageCreateFromJpeg(in); newtux = gdImageCreate(150,165); //create an image, 150 by 165 pixels white = gdImageColorAllocate(newtux, 255, 255, 255);// allocate white color red = gdImageColorAllocate(newtux, 255, 0, 0); // allocate black color gdImageCopyResized(newtux,oldtux,0,0,0,0,150,150,oldtux->sx,oldtux->sy); err=gdImageStringFT(newtux,brect, red,"/usr/X11R6/lib/X11/fonts/TTF/luxisr.ttf",10,0,0,160,"Tux ,The Linux Penguin"); if(err) fprintf(stderr,"Error : %s\n",err); out = fopen("tuxout.jpg", "w"); //open a file gdImagePng(newtux, out); //write the image to the file in the PNG format /* be good, clean up stuff */ fclose(out); fclose(in); gdImageDestroy(oldtux); gdImageDestroy(newtux); }