A linear transformation is a function $f:V\to W$ from vector space $V$ to vector space $W$ such that linear combinations (alternatively vector addition and scalar multiplication) are preserved.
An affine transformation is similarly a between from an affine space to another such that all affine combinations are preserved.
Could we use this as an alternate definition: A linear(/ affine/ etc) transformation is a function from one l(/a/e) space to another such that the image of the function is also a l(/a/e) space?
Let define the following map: $$f:\left\{\begin{array}{ccc}\mathbb{R} & \rightarrow & \mathbb{R}\\x & \mapsto & x^3\end{array}\right..$$ $\mathbb{R}$ is a vector space, $f(\mathbb{R})=\mathbb{R}$ is a vector space, howeover, $f$ is not a linear map. Hence, unless I misunderstood your definition, you can not define linear maps this way.