Use height and width variables when creating image buffer