compute image dimensions