added image size calculations