The image of $f$ is an interval $[a,b] \subset [0,1]$.

$T_f$ induce an isometric inclusion of $C([a,b])$ in $C([0,1])$.

If $T_f$ was compact then weak convergence of a bounded sequence in $C([a,b])$ would imply norm convergence in $C([0,1])$ which would in turn (as $T_f$ is isometric) imply norm convergence in $C([a,b])$. which is only possible if $C([a,b])$ is finite dimensional i.e. if $f$ is constant.



(edit: $C([a,b])$ is embeded in $C([0,1])$ by extending the functions by their value on the boundary outside $[a,b]$ and I'm identifying $T_f$ with its restriction to $C([a,b])$, which is also compact...)