  In this article we give a sufficient condition for a morphism $\varphi$ from
a smooth variety $X$ to projective space, finite onto a smooth image, to be
deformed to an embedding. This result puts some theorems on deformation of
morphisms of curves and surfaces such as $K3$ and general type, obtained by ad
hoc methods, in a new, more conceptual light. One of the main interests of our
result is to apply it to the construction of smooth varieties in projective
space with given invariants. We illustrate this by using our result to
construct canonically embedded surfaces with $c_1^2=3p_g-7$ and derive some
interesting properties of their moduli spaces. Another interesting application
of our result is the smoothing of ropes. We obtain a sufficient condition for a
rope embedded in projective space to be smoothable. As a consequence, we prove
that canonically embedded carpets satisfying certain conditions can be
smoothed. We also give simple, unified proofs of known theorems on the
smoothing of $1$--dimensional ropes and $K3$ carpets. Our condition for
deforming $\varphi$ to an embedding can be stated very transparently in terms
of the cohomology class of a suitable first order infinitesimal deformation of
$\varphi$. It holds in a very general setting (any $X$ of arbitrary dimension
and any $\varphi$ unobstructed with an algebraic formally semiuniversal
deformation). The simplicity of the result can be seen for instance when we
specialize it to the case of curves.
