Is $(gf)(X) = g ( f(X))$ in a category? Let $\mathcal C$ be a category with images à la this Wiki article.
Let $f \colon A \longrightarrow B$ and $g: B\longrightarrow C$ be two morphisms. Let $X \xrightarrow{r} A$ be a subobject. Then $f(X)$ is defined to be the image of $fr$. Is it true that $$ (gf)(X) = g (f(X))?$$ I can show that $(gf)(X) \subseteq g(f(X))$ since it is reasonably easy to draw an arrow using the universal property of the image.
 A: As I find myself often saying on this site, the notion of ‘image’ in a category without enough structure is often quite badly behaved and not interesting.
First, a positive answer. Let $\mathcal{C}$ be a category with pullbacks (or at least, pullbacks of monomorphisms). Then for each morphism $f : A \to B$ in $\mathcal{C}$ we get a pullback functor $f^{-1} : \textrm{Sub}_\mathcal{C}(B) \to \textrm{Sub}_\mathcal{C}(A)$. If $\mathcal{C}$ has image factorisations, then every such functor has a left adjoint, $\exists_f : \textrm{Sub}_\mathcal{C}(A) \to \textrm{Sub}_\mathcal{C}(B)$ that sends a subobject $A' \rightarrowtail A$ to the image of $A' \rightarrowtail A \xrightarrow{f} B$. Now, it is well-understood fact that left adjoints are unique up to unique isomorphism, and the pullback pasting lemma implies $f^{-1} g^{-1} \cong (g \circ f)^{-1}$, therefore $\exists_g \exists_f \cong \exists_{g \circ f}$, as expected. In particular, this is true when $\mathcal{C}$ is a regular category, which is the usual setting for studying image factorisations.
Now, a negative answer. Consider the following category:


*

*Objects are $T, A, B, C, B', C', C''$.

*Morphisms are $x, y, z : T \to A$, $f : A \to B$, $g : B \to C$, $\overline{f} : A \to B'$, $b : B' \to B$, $c : C' \to C$, $c' : C'' \to C'$, $\overline{g \circ b} : B' \to C'$, $\overline{g \circ f} : A \to C''$, plus their composites, subject to these equations:

*

*$f = b \circ \overline{f}$

*$g \circ b = c \circ \overline{g \circ b}$

*$\overline{g \circ b} \circ \overline{f} = c' \circ \overline{g \circ f}$

*$\overline{f} \circ x = \overline{f} \circ y$

*$\overline{g \circ f} \circ x = \overline{g \circ f} \circ y = \overline{g \circ f} \circ z$



By realising $\mathcal{C}$ as a certain non-full subcategory of $\textbf{Set}$ (say, $T = \{0\}$, $A = \{ 1, 2, 3 \}$, $B' = \{ 4, 5 \}$, $B = \{ 6, 7 \}$, $C'' = \{ 8 \}$, $C' = \{ 9 \}$, $C = \{ 10 \}$), one can verify the following inequations:


*

*$x \ne y$, $y \ne z$, $z \ne x$.

*$\overline{f} \circ y \ne \overline{f} \circ z$.


Thus, $f, \overline{f}, g, g \circ f, \overline{g \circ f}, g \circ b, \overline{g \circ b}, \overline{g \circ b} \circ \overline{f}$ are not monic, while the rest are. It is not hard to check that we have the following image factorisations:
\begin{align}
f & = b \circ \overline{f} &
\overline{f} & = \textrm{id}_{B'} \circ \overline{f} &
g & = \textrm{id}_C \circ g \\
g \circ f & = (c \circ c') \circ \overline{g \circ f} &
\overline{g \circ f} & = \textrm{id}_{C''} \circ \overline{g \circ f} \\
g \circ b & = c \circ \overline{g \circ b} &
\overline{g \circ b} & = \textrm{id}_{C'} \circ \overline{g \circ b} &
\overline{g \circ b} \circ \overline{f} & = c' \circ \overline{g \circ f} \\
\end{align}
In particular, the image of $g \circ f$ is not isomorphic to the image of $g \circ b$, even though $b$ is the image of $f$. Unsurprisingly, this must be because the category doesn't have enough pullbacks, and sure enough, the pullback of $\overline{g \circ b}$ along $c'$ does not exist.
