added custom bgimg support to genimg.py