Infer map size from image