I did not manage to solve the problem by ridgy's answer. I managed to solve it in the end by LaTeX in the thread How to rotate image 90 if height overful?How to rotate image 90 if height overful? The case where both picture dimensions are bigger than page size is unsolved in the thread.
exiftool is about one file. To have pictures relationally nice on the page, you need LaTeX.
The tools discussed here are not sufficient but the handling of the page orientation of all pictures is needed.
So the question is flawed itself, I think, and cannot be handled only by