#include <stdio.h>
#include <gd.h>

int main()
{
 /*image initialisieren*/
 gdImagePtr image;
 FILE *png;
 int black, white, red, blue, yelow;

  png = fopen("./bild1.png","rb");
  if(png==NULL) { /*Fehler*/ exit(0); }
  image = gdImageCreateFromPng(png);
  fclose(png);

 /*Speicher für die Farben allozieren*/
 white=gdImageColorAllocate(image,0,0,0);   /*Weiss*/
 black=gdImageColorAllocate(image,255,255,255); /*Schwarz*/
 red  =gdImageColorAllocate(image,255,0,0); /*rot*/
 blue =gdImageColorAllocate(image,0,0,255); /*blau*/
 yelow=gdImageColorAllocate(image,255,255,0); /*gelb*/

 gdImageRectangle(image,25,25,75,75,black);
 gdImageFill(image, 45,45, black);
 gdImageFill(image, 55,55, black);
 gdImageFill(image, 45,55, white);
 gdImageFill(image, 55,45, white);

 png = fopen("bild2.png","wb");

 gdImagePng(image,png);

 fclose(png);

 gdImageDestroy(image);

 return 0;
}

