I am new to categories and I found in a book that it is possible to construct a category in which the following are true: there exist morphisms $f:A \to B$ and $g:B \to C$, and monomorphisms $\alpha:A' \to A$, $I:B' \to B$ and $J:C' \to C$ such that


(1) $I$ is an image of $\alpha$ under $f$.


(2) $J$ is an image of $I$ under $g$.


(3) $J$ is not an image of $\alpha$ under $g \circ f$.


This is rather counterintuitive, but I kind of see that what is counterintuitive is the definition of "image".


So, here comes my question: What are conditions to impose on the category to ensure that (3) does not occur?



Image of composite morphisms
This cannot happen in a regular category. Below I give a proof using the sequent calculus of subobjects in a regular category. It can be deciphered using the book 'Sketches of an Elephant Volume 2' by Peter T. Johnstone, in particular chapter D1.


I write $\beta:=I$ and $\gamma:=J$. I hope the definition of image given in your book is the same as mine, namely the image of a subobject (~mono) $S$ under a morphism $\phi$ is the least subobject of the codomain of $\phi$ through which $\phi\circ\overline{S}$ factors, where $\overline{S}\in S$.


Assume we know
$\exists x(\alpha(x)\wedge f(x)=y) \dashv\vdash\_{y:Y}\quad \beta(y)$ and $\exists y(\beta(y)\wedge g(y)=z) \dashv\vdash\_{z:Z}\quad \gamma(z)$. We then want to prove two things. The first is that $\exists x(\alpha(x)\wedge g(f(x))=z)\vdash\_{z:Z}\quad \gamma(z)$, the second that $\gamma(z)\vdash\_{z:Z} \quad \exists x(\alpha(x)\wedge g(f(x))=z)$.


For the first we have the following. 
$\alpha(x)\wedge g(f(x))=z$
$\vdash\_{x:X,z:Z} \quad\alpha(x)\wedge g(f(x))=z \wedge f(x)=f(x)$
$\vdash\_{x:X,z:Z}\quad \alpha(x)\wedge g(f(x))=z \wedge \beta(f(x))$
$\vdash\_{x:X,z:Z}\quad \gamma(g(f(x)))$. Therefore $\alpha(x)\wedge g(f(x))=z\vdash\_{x:X,z:Z}\quad \gamma(z)$ and hence $\exists x(\alpha(x)\wedge g(f(x))=z)\vdash\_{z:Z}\quad \gamma(z)$.


The second also holds. First note that $\beta \wedge g(y)=z$
$\vdash\_{y:Y,z:Z}\quad \exists x(\alpha(x)\wedge f(x)=y)\wedge g(y)=z$
$\vdash\_{y:Y,z:Z}\quad \exists x(\alpha(x)\wedge f(x)=y\wedge g(y)=z)$
$\vdash\_{y:Y,z:Z}\quad \exists x(\alpha(x)\wedge g(f(x))=z)$ from which we may conclude that $\gamma(z)\vdash\_{z:Z} \quad \exists y(\beta(y)\wedge g(y)=z)\vdash\_{z:Z} \quad \exists x(\alpha(x)\wedge g(f(x))=z)$.


