update scripts for template extraction and creating random backgrounds