Let $f:X \to Y$ be a morphism of finite type of irreducible schemes over an algebraically closed field of characteristic $0$. Assume that $Y$ is non-singular. Let $x \in X$ be a closed point and $T_xf:T_xX \to T_{f(x)}Y$ the induced linear map. Then, Proposition III.$10.6$ of Hartshorne's "Algebraic geometry" implies that for a general $x \in X$, $\dim \mathrm{Im}(f) \le \mathrm{rk}(T_xf)$ (with notations same as in Hartshorne).
Suppose now that we consider the same setup except that the algebraically closed field in the beginning is of positive characteristic. My question: Is there any known condition on $f$, other than smoothness, under which the above inequality still holds true? Any reference/hint will be most welcome.