Creating a TImage from scratch

I want to create a TImage dynamically and fill it, say, with all black pixels. Since I want to be able to set the size dynamically, I don’t want to have to just make something in photoshop to read into root. The documentation suggests I can create a new TImage with Create(), but I don’t understand how to initialize the image using SetImage. Any help would be greatly appreciated.

Have you looked at the examples in $ROOTSYS/tutorials/image/ ?

see $ROOTSYS/tutorials/image, in particular hist2image.C