moved code for getting size of initial images to corresponding function