Is the image a universal object?

Given a function $$f:X\to Y$$ in category $$\mathcal{C}$$, one can construct the image as a factorisation $$f=(e:I\hookrightarrow Y)\circ(g:X\to I)$$ that is universal (initial) among all such factorisations.

This does seem like a universal property. But I can't figure out how this can actually be constructed as an initial object in a comma category, because there are morphisms both from and to the object.

• It is not guaranteed that each morphism has an image. – Paul Frost Jan 23 at 13:05

Let $$\newcommand\Sub{\operatorname{Sub}}\Sub(Y)$$ the preorder of subobjects of $$Y$$ in $$\mathcal C$$. Then the "image functor" can be seen as a left-adjoint of the forgetful functor $$\mathcal C/Y\leftarrow\Sub(Y)$$.
In particular, if $$f=e\circ g$$ is an image factorization of $$f$$, then $$g:(X,f)\to(I,e)$$ is a universal arrow respect to the forgetful functor $$\mathcal C/Y\leftarrow\Sub(Y)$$.
If $$\mathcal C/Y\leftarrow\Sub(Y):\Gamma$$ denote such forgetful functor, then $$((X,f),g)$$ is an initial object in the comma category $$(X,f)\downarrow\Gamma$$.