Write text to an Image?

Hi, Is there a way to write text to an Image instance in the way that the draw method of the Image class allows graphics to be written with Pen?
Thanks

Image.drawStringAtPoint

Thanks a lot, I don’t know how I missed that. The example is not working for me but I’ll come back later and nut it out.

If it doesn’t work, you could brew your own/fake it like this:

(
i = Image.new(SCDoc.helpSourceDir +/+ "images/Swamp.png");

i.plot;

f = {
	|image, x, y, string, font=(Font.default), color=(Color.black)|
	image.draw{
		Pen.stringAtPoint(string, x@y, font, color); 
	};
};

f.(i, 0, 0, "Hello World!");
)

This works, thanks for your help!

1 Like

I just logged a bug for that: Image:drawStringAtPoint example is broken · Issue #5934 · supercollider/supercollider · GitHub

At least 3 mistakes in that example, wheeewwwwwww…

hjh