SDL 1.2 for headless use

Dear community,

I have been using libSDL 1.2 for many years and I’m happy with it since I usually only need a window, set a pixel maybe draw a line/a circle.

This time I wrote a visualization for data. Now this is supposed to run on a server with no graphics. So I’d like to render it into a bitmap and upload the image to another server.

So far I found no way to initialize SDL without a graphics card. The workaround was to allocated an SDL_Surface and the pixels myself and trick the drawing functions into believing they are actually working on a valid structure. However, on a small server with little memory I get buffer overflows.

I know there are a couple of internal fields in SDL_Surface which I do not allocated myself, so the solution is dirty.

The question is: How can libSDL be initialized headlessly only drawing into a bitmap?

Can anyone help?

Thanks in advance and cheers,