Helpers for checking if coordinates lies inside image.