I'm writing an Apache module in C. Now I would like to show some statistics calculated within this module. Is it possible to create a statistic image in format PNG on-the-fly?

I found some descriptions about the GDI, but always "How can I load a ....?". I will create an empty image and then draw x-,y-axis and a nice curve (line). Does anyone have a good tutorial about solving this idea?