Added code to rescale the bitmap