This will find jpegs from your camera over 2MB size (change the size switch on 'find' to suit yourself) and recompress at 80% quality. Or lower if you want, to get smaller images. Experiment to see if you can detect any difference. This is lossy so only do it once.
You can then reduce the size a bit further if you wish by loading stegdetect_i686.uci (which happens to contain the jpeg utils as dependencies) and running:
This will need to be put in a loop to do a batch; the batch instructions in the jhead docs don't seem to work with this jpegtran.make jpegtran also use -optimize, it takes a little more time but produces smaller images..
original here.