Derivative for x-direction for image
From my understanding, you are asking about computing the derivative, at some pixel $(x,y)$, with respect to the $x$ direction. We can approximate a derivative of some function $f(x,y)$ along the $x$ direction using the following Finite Difference formula:

$$ \frac{\partial f}{\partial x} \approx \frac{f(x+h,y) - f(x,y)}{h} $$

for some $h \neq 0$, usually using $h \ll 1$ if possible. For an image, the best you can do with this formula is the following:

$$ \frac{\partial f}{\partial x} \approx \frac{f(x+1,y) - f(x,y)}{1} = f(x+1,y) - f(x,y) $$

This is because $f(x,y)$, the pixel color values at $(x,y)$, is a value of $1$ away from the nearest neighboring pixels in both the $x$ and $y$ direction.