
% exiftool '-subject+<$orientation' -ext xmp -overwriteoriginalinplace. So I used the following command in exiftool to set a subject keyword according to the original orientation: However, my photos from my old Canon 1Ds don't have the "Camera Orientation" metadata, and it seems that Any Filter can't search on the "Orientation" metadata (probably because the values of Orientation are integers, not strings). E.g., do a search for "Aggregate Text" "Searchable EXIF" "contains" "Rotate 90 CW". If all of your photos have the "Camera Orientation" metadata, it seems that you can use the Any Filter plugin to find them, which is quite straightforward. The next thing to do is to find the original orientation. The first thing is to restore all of the photos to "sensor orientation." Use Data Explorer to break your photos up into collections depending on the "Orientation with Respect to Image Sensor", and then rotate the photos in each collection appropriately (if they are rotated 90° CW, apply a 90° CCW rotation, etc.) The data explorer plugin can be used to restore a photo to "sensor orientation", but it can't be used to figure out the original camera orientation. (Confusingly, the Camera Orientation doesn't have a "Rotate 180" value.) I am using Canon cameras, and some of my cameras, but not all, also record this data in the Camera Orientation field. One place this is recorded is the Orientation EXIF field. When you import photos into Lightroom, they are oriented according to metadata that the camera adds to the photo.

So here is recipe in case others need to do it.

I needed to restore the orientation to a bunch of photos, and I couldn't find anything about this (admittedly, with a brief search).
