add height and width to canvas based on image dimensions