I recommend against changing the format from png to jpg. The sample shows a picture of a dog, but most screenshots should be of applications (having a limited color palette) and must of the time the goal is readability (jpg compression drastically reduces text clarity relative to png)
If you need to reduce the size of a screenshot it's often better to keep it as a PNG and reduce the number of colors. 256 colors nearly always carries all the information needed without blurring the edges or the text. Often 128 or 64 is fine. Don't use dithering - it harms the compression ratio, so you may as well use a few more colors instead.
Often just applying lossless PNG optimisations using a tool like https://imageoptim.com/mac will sometimes save a large percentage, although it can take a minute or so for the tool to finish.
It can encode the difference to the previous pixel either up or above (or some combination). In purely horizontal or vertical gradients that's just as efficient as encoding constant color (and in fact, the Wikipedia page shows an example). For gradients in other directions, it depends on how homogeneous the slope is (because it will zip the diff to the previous pixel, i.e. the slope).
Doesn't that example show that a 256-step gradient takes 256 bytes? A 256-step run of the same colour takes just a couple of bytes due to RLE, doesn't it? (Not an expert.)
I debated about adding "after the first row", but didn't (because it doesn't make sense for gradients in the other direction). Either way, both my and Wikipedia's point is that a simple gradient filling a 2D surface costs only a "1D amount" of bytes, which is going to beat JPEG (at "can still read text" levels of quality).
Also, I was surprised one common hack I used to see talked about a lot not dicussed given they delved into changes you can make on the CLI: you can change the default location (Eg to a "Screenshots" folder) instead of the default of cluttering the desktop
In terminal type "defaults write com.apple.screencapture location" where "location" is a path of your choosing.
(I'm fond of nesting a "screenshots" folder in the user directory pictures folder.)