added unicode support to genimg.py