Is it possible to add an image to a node programmatically?
Yes, make it part of the $node object when you save it. Save it using node_save().