You needn't script it. At least, I dunno how to do that
It's a matter of a few seconds, anyhow.
Letme try to show how. Sorry if I don't get the menue item names right - I'm using the german Version and can't really remember the english labelling from the previous Version.
Right-click on the pic. Use "select", "per color" (or something like that, it's way down the list that pops up), turn "impreciseness" down to "0", klick on a white pixel.
open the layers menue.
right-click on the pic again, choose "selection", "floating"
in the layer menue there will appear a "floating selection" entry, already marked as active (blue)
hit "keep transparency", than the "new layer" button. the floating selection will be converted into a transparent, "floating layer".
you may rename it to "pixels" or something ...
Activate the backgraound layer, do any smoothing and anti-aliasing you wish.
Proceed similarly for other colors to generate borders etc.
If you add another layer for "objects", you may copy in trees, bushes, mountains etc. from another pic easily. You may even select them later again and move them around by dragging - as long as you keep them on a seperate, transparent layer.
When done, merge all layers.
hope this is helpful
A.