Suppose that $K$ is a compact linear operator acting on a Banach space $X$ into itself. Then there exist closed subspaces $N$ and $Z$ with $N$ finite dimensional, $Z \subset \ker{K}$ and $$ X = N \oplus Z$$ One can easily show that $$ \ker(I-K)= \ker(I-K)|{N} $$ and $$ \mathrm{Im}(I-K) = \mathrm{Im}(I-K)|{N} \oplus Z$$
Where $(I-K)|N$ denotes the restriction of $I-K$ to the subspace $N$.
Consequently we have the following $$\dim{\ker(I-K)|{N}} \leq \dim{N} < \infty$$ and thus $\dim{\ker{I-K}} = \dim{\ker{(I-K)|{N}}}$
From what we know in finite dimensional spaces, it easily follows that $\dim{\ker{(I-K)}} = \dim{\ker{(I-K)|{N}}} = \mathrm{codim}\, \mathrm{Im}(I-K)|{N}$
The text I am working with claims that $\mathrm{codim} \,\mathrm{Im}(I-K) = \mathrm{codim}\,\mathrm{Im}(I-K)|{N}$. I don't see this. Can someone please help me?
Welcome to MSE! I'll write restrictions like this: $(I - K)|_N$, if you don't mind, but that's just a preference.
"$\dim{\ker{(I-K)|_N}} = \mathrm{codim}\, \mathrm{Im}(I-K)|_N$" is not quite true. I do not know whether your source was wrong or you rewrote $\dim N - \dim \mathrm{Im}(I - K)|_N$ as $\mathrm{codim} \, \mathrm{Im}(I - K)|_N$, but basically the problem here is that codimensions depend on the ambient space: you can always consider your operator $(I - K)|_N$ as having values in an even bigger space, but while the kernel and the image of your operator do not change, and hence do not change dimensions upon this new point of view, the codimension of the image will become bigger and bigger as that space gets expanded. So when stating facts about codimensions, it's quite important to pay close attention to the ambient space.
Precisely, "$\dim \ker f = \mathrm{codim} \,\mathrm{Im}\,f$" for a linear $f$ starting from a finite-dimensional space $E$ only works if we see $f$ as $f : E \to F$ with $\dim F = \dim E$, as we always have: $$\begin{cases}\dim \ker f = \dim E - \dim \mathrm{Im}\, f \quad\text{(rank-nullity theorem)}\\ \mathrm{codim}\,\mathrm{Im}\, f = \dim F -\dim \mathrm{Im}\, f \quad\text{(more or less by definition of codimension)}\end{cases}$$
Now that (hopefully) this confusion has been dealt with, let's see how we can obtain the desired result $\dim N - \dim \mathrm{Im}(I - K)|_N = \mathrm{codim}\, \mathrm{Im}\, (I-K)$:
Let $S$ be any (algebraic) complement subspace of $\mathrm{Im}(I - K)$.
Then, we have: $$N \oplus Z = X = S \oplus \mathrm{Im}(I - K) = S \oplus Z \oplus \mathrm{Im}(I - K)|_N = (S \oplus \mathrm{Im}(I - K)|_N) \oplus Z$$ Hence, since $N$ is already finite-dimensional and all complements of $Z$ in $X$ have the same dimension (which is $\mathrm{codim}\, Z$), we get: $$\dim N = \dim (S \oplus \mathrm{Im}(I - K)|_N) = \dim S + \dim \mathrm{Im}(I - K)|_N$$ which provides: $$\dim N - \dim \mathrm{Im}(I - K)|_N = \dim S = \mathrm{codim}\, \mathrm{Im}\, (I-K)$$ Hope this helped!