Let $X$ be a scheme, and $x \in X.$ Let $U=\text{Spec}(A)$ be an open affine subset containing $x,$ then we have the natural morphism $\mathcal{O}_X(U) \to \mathcal{O}_{X,x}$ inducing a morphism $ \text{Spec} \;\mathcal{O}_{X,x} \to U$ and by composing it with the open immersion $U \hookrightarrow X$ we get a morphism $f: \text{Spec} \;\mathcal{O}_{X,x} \to X.$
Why this definition does not depend on the choice of $U?$ and
What is the image of $f?$
(1) Let $U$ and $V$ be open affine subsets of the scheme $X$ such that $x\in U\cap V$. Choose an open affine subset $x\in W\subseteq U\cap V$. Prove that the compositions $\text{Spec}(O_{X,x})\to W\to U\to U\cup V$ and $\text{Spec}(O_{X,x})\to W\to V\to U\cup V$ are equal to the composition $\text{Spec}(O_{X,x})\to W\to U\cap V\to U\cup V$. (Hint: recall that $U,V,W$ are affine open subsets of $X$ and you understand affine schemes by commutative algebra!)
(2) If $A$ is a commutative ring and if $p$ is a prime ideal, then the spectrum of the localization homomorphism $A\to A_{p}$ is the map $\text{Spec}(A_p)\to \text{Spec}(A)$. The image of this map equals the set of all prime ideals of $A$ contained in $p$ (prove this fact from commutative algebra if it is not obvious).