The best way for LLMs to do this is likely to write a scratch program (which is what it seems to have reached for in the second half), write code (which they are good at) and have the library create the image.
At some point it is just easier to handle such things yourself, and use them with text-based formats.