The tool of choice is mogrify which come from the imagemagic package on your linux platform.
I had one image that looked fine when I displayed it using display tools in linux but when placed into a webpage the image would be reversed.
I tried using css style transform: auto-orient; but all attempts failed. My css files are complicated to the point where even I get lost. So I needed to find another external solution.
It seems that the jpg image file had an internal orientation that refused to be respected by any web server.
The solution was to transform the file using:
mogrify -rotate 180 path/to/file.jpg
This reversed the image externally and now both bash display command and any web server displays the file correctly. Problem solved.