changed function genBitmapImage()