When taking photos using a digital camera, the orientation of some images might not be correct. When viewing them on the computer, their orientation is not correct and one has to turn one's head left or right.
Nowadays, quite a number of digital cameras have an orientation sensor and when taking the photo, the orientation information (and a lot of other data) is saved together with the image data. This orientation information can be read by graphic programs which can automatically rotate the image.
By default, in XnView the automatic rotation is disabled. To enable it you have to check Rotate images based on EXIF orientation in Tools > Options > Read. After activation, XnView rotates the preview and the images in viewer mode. The thumbnails are not rotated so that you can see the actual orientation of each image.
Also, you can rotate permanently the images based on the EXIF information. This will ensure that the images are oriented properly when viewing in any graphic programs. To do this, select all your images and select JPG Lossless transformations from the Tools menu or toolbar.
The rotation is lossless so quality is not affected. Make sure that you keep the checkbox "Reset EXIF orientation value" when rotating permanently. Otherwise XnView will rotate your images again.
After activating the automatic rotation, your old images might be rotated automatically, although they are already oriented properly. The reason is that these images have been rotated without resetting the EXIF orientation value.
To correct this, you select all (!) your images and choose Tools > JPG lossless rotation. In the dialog you activate the checkbox "Reset EXIF orientation value" and confirm the dialog with "OK". The orientation value will be reset this way and these images will not longer be rotated.