I searched everywhere for a solution to convert text to image and save it to disk in transparent PNG format.
Currently I am creating an ofBuffer where I load the text file and draw it on screen using drawString. Then I have an ofImage object where I grab the screen (grabScreen) and then saving the image.
exactly what hahakid said but just a note that when you clear, clear with ofClear(255,255,255,0) – ie, clear with full transparency, ie:
fbo.begin();
ofClear(255,255,255,0);
fbo.end();
note that whatever color you clear with if you draw text that has alpha (most fonts have some alpha on the edges) it will blend with that color. So, if you clear the background with white and full alpha, and draw black text, you’ll see a white halo around the black text.
I don’t know if there’s a faster way, but I usually do this to read out the fbo and save it to an image: