#include <gd.h>
#include <stdio.h>

int main() {
	gdImagePtr im; //declaration of the image
	FILE *jpegout; //output file
	int black,white;

	im = gdImageCreate(100,100); //create an image, 100 by 100 pixels

	black = gdImageColorAllocate(im, 0, 0, 0); // allocate black color
	white = gdImageColorAllocate(im, 255, 255, 255);	// allocate white color	
	gdImageLine(im, 0, 0,100,100, white); // draw a line using the allocated white color.

	jpegout = fopen("test.jpg", "w"); //open a file
	gdImageJpeg(im, jpegout, -1); //write the image to the file using the default quality setting

	/* be good, clean up stuff */
	fclose(jpegout); 
	gdImageDestroy(im);
}
