scheme-theoretic image behaves nicely with composition, base change? Scheme-theoretic image is still somewhat of a mystery to me, and I wasn't able to work out proofs of either of the following two statements that seem plausible to me:


*

*If $X\to Y\to Z$ is a map of schemes, $Y'\subset Y$ is the scheme-theoretic image of $X\to Y$, and $Z'\subset Z$ is the scheme-theoretic image of $Y'\to Y\to Z$, then $Z'$ is also the scheme-theoretic image of $X\to Z$. (i.e. you can compute scheme-theoretic image one map at a time)

*If $X\to Y$ is a map of $S$-schemes, and $X'\to Y'$ is the corresponding map after base-changing to $S'$, then the scheme-theoretic image of $X'\to Y'$ is the base-change of that of $X\to Y$.
I wasn't able to get either one to follow immediately from the universal property of scheme-theoretic image, so perhaps these are either false or in need of additional hypotheses (maybe that the images can be computed affine-locally, e.g. all of the maps are quasicompact).
Anyway, are these true, possibly with additional hypotheses? Could someone provide proofs?
 A: For scheme-theoretic images to be well-behaved, you need the morphisms to be quasi-compact. 
Some sources will also require quasi-sep., but that is not necessary; quasi-compact is enough for the the kernel of $\mathcal O_Y \to f_*\mathcal O_X$ to be a quasi-coherent ideal sheaf, which then cuts out the scheme-theoretic image of $f: X \to Y$.
Once you have this sheaf-theoretic description, checking compatibility with flat base-change, and so in particular with Zariski localization, is straightforward.
Details are in the stacks project.  
One can then check things like compatibility with compositions (as in your question) just by computing successive kernels of the pull-back maps; i.e. in terms of the ideal sheaves described above.
In the non-quasi-compact case, for morphisms of non-reduced schemes (so that the
scheme-theoretic images aren't determined by topology alone) things can be a mess, and you can presumably find counterexamples to statements that you might naively guess were true.   The stacks project gives some such counterexamples, and once you see how to make them, you can probably create more.

One more thing: even in the quasi-compact case, scheme-theoretic images don't typically commute with non-flat base-change.    
First of all, if $X \to Y$ is not surjective, but is scheme-theoretically dominant (i.e. has $Y$ as its scheme-theoretic image) and you take $y \in Y$ to not lie
in the image, then the scheme-theoretic image of the base-change to $y \in Y$ is empty, 
while the base-change of the scheme-theoretic image is $y$ itself.
More substantively, even if $X \to Y$ is scheme-theoretically surjective
(not just scheme-theoretically dominant), i.e. is surjective and has $Y$ as its
scheme-theoretic image, it's pretty easy to find examples which don't commute
with base-change to $y \in Y$.
This isn't a pathology, but is reasonable when you think about the construction in terms of kernels of maps of ring (as above), since formation of kernels doesn't typically commute with non-flat base-change.  It's not to hard to find counterexamples even in very simple settings; my memory is that Eisenbud and Harris give some, and that I found them once just by googling something like "scheme theoretic image + base-change".  Once you think in terms of kernels, you can probably make some counterexamples by yourself, in any case.
