Generating tga image file with the script

Hi everyne,

I've searched the whole site but found no similar scripts (or perhaps I missed some).

In the maxscript reference I found the sample script how to generate a script in a lister with pixel values array from a tga image, but I can't find out how to make the opposite action.
What I actually need is converting diffuse color of a standart material to a diffuse map of the same solid color generating 32x32 tga.

Looking forward to any help.