First, one needs to understand that there may be additional lenses, such as the one in your eye or in the camera that help to produce the image that your see. If we ignore such a lens and consider only one lens then one can compute the result as follows. (One can include the additional lenses, but then computation would need a few extra steps.)
Let's assume there is an object at $z=0$, scattering light toward an observer (in the $z$-direction). Between the object and the observer ther is a lens located at $z=L_1$ and the observer is located at $z=L_2>L_1$.
The light shown in your images is poly-chromatic (consist of multiple colours). So you'll need to perform the calculation for all the different colours and then add the results.
The first step is the perform the free space propagation of the light coming from the object. The general expression takes the form
$$ g(u,v) = \int f(x,y) K_z(u-x,v-y) dx dy . $$
Here $f(x,y)$ is the two-dimensional function of the light field coming from the object, in the plane of the object; $g(u,v)$ is the light field at a location $z$; and $K_z(u-x,v-y)$ is the appropriate kernel function for propagation of the light over a distance $z$. The nature of the kernel function depends on the nature of the light, namely, whether it is coherent, or incoherent. In case the light is coherent, the kernel is given by the Fresnel kernel
$$ K_z(u-x,v-y) = \Phi(u-x,v-y) , $$
where
$$ \Phi(x,y) = \frac{i}{\lambda z} \exp\left[\frac{-i\pi}{\lambda z}(x^2+y^2)\right] . $$
(Here, I've used the convention that phase increases with time.) The kernel function in the case of incoherent imagining is a bit more complicated. In general one needs to consider the propagation of the mutual coherence function of the optical field, which is the correlation function of the optical field with itself, each of which is propagated as if it is a coherent field. See for instance the van Cittert-Zernike theorem.
So the idea is now to propagate the light all the way to the lens. Then one multiplies the light field with the transmission function of the lens, which is given by
$$ t(x,y) = \exp\left[\frac{i\pi}{\lambda f}(x^2+y^2)\right] , $$
where $f$ is the focal length of the lens.
The result after the lens is then propagated again over the distance between the lens and the observer. Again, the situation is a bit more involved with incoherent light. I suggest you read up on optical transfer functions for a general treatment.
You'll notice that the expressions depend on the wavelength $\lambda$. So if the image contains multiple colours one needs to perform this computation for all the different wavelengths (colours) and then add (or integrate over) the results in the end.
Hope this addresses your needs.