[SalesForce] Dynamically Generate Text to display over an Image in Apex

Is it possible to dynamically generate an image in Apex? So for example let's say I have 5 background images but need to dynamically display different text on top of the image according to the record being viewed. The text itself will be based on a custom object so ideally I was looking at Apex to avoid anyone having to create a new image every time new text is added.

I thought I had read about a library/class that could do something like this in the past but I've not been able to find it again (maybe I was dreaming…)

Edits:
It will be viewed on a VF page, static resources could be used for the background image but not for the dynamic part.

Best Answer

You can do this with CSS where you use a field to include the text that will display over top of your image using {!field_to_display__c} in the appropriate portion of your CSS. The CSS would need to be included in your page. If you're changing the image at the same time, you could also do that as well. Your question isn't stated clearly enough to know if you want to do both, but field expressions can be used in your CSS.