yes you can!
in the DrawBot code base test we use:
rect(10, 10, 100, 100)
pilObject = saveImage("PIL")
you need to have PIL installed yourself
(the drawBot forum is almost closed, I keep it as read only, to much spam, sorry, move to drawBot channel in the RoboFont discord)