Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m devastated.

Lightroom: Photo Orientation Lost

Lightroom seems to use the wrong source for finding out about a photo's orientation when there is conflict between the catalogue metadata and the data stored in a DNG file.

For some reason Lightroom decided that the catalogue metadata is out of sync with the metadata stored in the DNG files.

When I open my catalogues, I can see the photos in the correct orientation until LR starts to update previews, e.g., in the Library grid mode.

All my portrait orientations are lost and replaced with landscape orientation. All other edits are retained.

A contributing factor could be that my K100D doesn't store the orientation of a photo in the photo's metadata, so all orientations that differ from the default landscape orientation are LR edits. However, all other edits stay in place, so I wonder why LR

a) decided that catalogue and photos are out of sync, and
b) loses all portrait orientation information.

I'm frustrated BIG time because all my catalogues are affected. Imagine you had to redo all the orientations of all your photos!

I tried to go back to LR 3.3 and even LR 3.2 because I thought maybe LR 3.4 RC is causing the problem. But all versions do the same. Going back to backups of catalogues doesn't help, LR insists to undo all orientation edits I did.

Is there any chance that I won't have to do manually fix all my catalogues?
4 people have
this problem
+1
Reply
  • Sorry TK. Not sure what else to say.

    But, since the orientations are stored in the catalog, you could fish those out using an SQL client, then transfer them to the new rebuild. This would be easy to do for anybody familiar with sql and lr database - I'll take a whack if you want (I'm not a database person really, but I know enough to get into trouble...). Now that I think about it, you may even be able to transfer edit histories from one catalog to the other - not sure about that though...
    • Hi Rob, thanks a lot for responding. My SQL knowledge is rudimentary. I took the OS lectures rather than the DB lectures. :)
      I can do a query using "select", "where", etc. What I couldn't do without diving into SQL literature is to extract a column (the photo orientations) and then update the messed up catalogue with just that column. Do you know how to do that? Could you post it here?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • My SQL skills are also limited, but I have written a few queries to read/write the Lr database. Are you missing anything besides orientation and edit history?
    • Everything else seems to be there. Note that the "orientation loss" and corruption (which motivated me to start with a new catalog that now misses the edit histories) occur in two separate catalogues. In other words, I wouldn't need both things at the same time. If I could transfer orientations and edit histories separately that would be brilliant.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • So, just to get you started: the query to find the photos with anything other than landscape orientation is:

    select * from Adobe_images where orientation = 'DA' or orientation = 'BC' or orientation = 'CD'

    Legend (Pythonic):

    if photoInfo["orientation"] == 'DA':
    im = im.transpose( Image.ROTATE_90 )
    elif photoInfo["orientation"] == 'BC':
    im = im.transpose( Image.ROTATE_270 )
    elif photoInfo["orientation"] == 'CD':
    im = im.transpose( Image.ROTATE_180 )

    Can you get that much to work? - I assume you have an SQLite client app by now?
    • My SQLite client only allows one database to be open at a time (SQLSpy). So, if I were going to transfer info from one to another, I'd probably write a Python script to do it (it has built in sqlite3 support). A big database guy would probably laugh at my method...
    • Rob, thanks heaps. I've got the SQLite client and have successfully issued queries like the one you posted in the past. I'm now challenged to write/save the result and then use it again later. I believe the DB-way would be to create a new table containing two columns (key + orientation) and then later update the table with all orientations set to AB with the saved table. I haven't run any Python scripts on my machine yet, so that approach wouldn't be the most straightforward for me. But I'd go that route if there is no SQLite solution.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Edit history is mostly in table named Adobe_libraryImageDevelopHistoryStep.

    One thing you'd need to do is get the id's right - dunno whether there are other things...

    That's all for now...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Rob, I had an idea. Could one extend the Adobe_images table with one more column (say "trueOrientation) and copy all orientation values over to that column?

    I could then let LR mess up the "orientation" column but when its done, use SQLite to copy the values from "trueOrientation" to "orientation" again. Would that work?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I'm not sure how well Lightroom would like you adding columns, but you could always try it - you may be asking for trouble though...

    Anyway, you are past this now, aren't you?

    A proper database guy could probably save the results of the sql query to a text file, then reload that for transfer to another database.
    • "Anyway, you are past this now, aren't you?": No, unfortunately not. This problem was/is independent of the catalogue corruption I experienced.

      I have many images on an external, portable hard drive and some day LR decided that they are all out-of-sync with the catalogue data. I have no idea was caused this. When LR re-renders the Library previews, it resets all orientations to "landscape".

      I'd still appreciate a solution for the orientation problem.

      Thanks for your support, Rob. I'll try to find out whether it is possible to update a database with data from another file.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I would think its possible just to issue the query to read the orientations and save to text file somehow. Then open the target database and import the text somehow and issue the sql to update the catalog.

    Not sure how exactly. One hacker way:

    issue the command to query for orientations, and copy the text to the clipboard, paste in a text editor then use an editor macro to restructure into an sql update statement...

    There's probably a better way...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Is it normal that a change to a photo's orientation is not stored in the (develop module) history? Does anyone also feel that it should be part of the history?

    One cannot search (e.g., using a smart collection) for photo orientation either. Not a biggie for me but could be useful in general.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Yes it's normal behaviour that it's not stored in history, although there's an argument either way. The strongest argument is for shots such as the night sky, where you could accidentally rotate and not realise. On the other hand, it's not a Develop adjustment, and some believe only Develop adjustments should be included in history. If you feel strongly, post it as a separate feature request so it doesn't get lost.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • As far as the catalog being out of sync with the files goes, there was a bug in 3.0 that set the metadata as conflicted. Fix for that was the write the metadata to the files and read it back once, and then it stays fixed.

    If it's not that, have the photos been viewed in other software? Could something else have edited the files? If not, and you're happy that the catalogs contain the most up to date data, do the above and update the files.
    • view 1 more comment
    • I thought that the bug was only in 3.0 and solved in 3.2, and only affected those undergoing the catalog upgrade from 2.x to 3.0, but I could be wrong about that. You may have run into a different bug.

      If LR's orientation looks correct and you haven't changed anything in the files, then write LR's metadata back to the files and read it back again and you should hopefully solve the problem. The only downside to that would be if you used an online backup, as the DNG files would be marked as modified in the process. Try it on one or two and see if that solves it before trying it on everything.
    • "If LR's orientation looks correct and you haven't changed anything in the files, then write LR's metadata back to the files": The problem is that LR resets the orientation. In the grid view they first look OK until LR does an update to the previews, resetting all orientations for the images on the external drive in the process.

      I therefore have to redo all the portrait orientations manually.

      I made some progress (addressing catalogue by catalogue) and LR then remembers the orientations (as it did before) but I surely wouldn't want this to happen again.

      Not sure why I would have to read back the metadata from the files again, but if that would prevent the issue from happening again in the future, I could try it with a catalogue copy just to make sure I'm not losing anything (e.g., edit histories).
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I’m frustrated
    I have portrait oriented NEF files produced by a Nikon D700 and once (2 years ago) edited with Nikon ViewNX (ver 1.3, 1.4, 1.5).

    Portrait orientation was set by the camera. Editing was basic exposure and white balance correction as well as some IPTC/XMP data was added.

    When I import these files into LR 3.4.1, they are display correctly in portrait mode. In LR I set white balance to tungsten and create a new sidecar file (ViewNX did not create one).

    Now I drop this file in LR (just from the catalog) and re-import it. Et voilĂ , now the image is display landscape oriented.

    It even happens (being displayed in wrong orientation) when I make a file copy of the NEF/XMP file pair (when it is still present in the LR catalogue) to another folder and import a second time from this folder (unchecked "drop duplicates" in the import dialogue).
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • 1
    Similar problem here in LR 3 x64. This time with jpg files from a canon S95.
    Grid and loupe orientation are OK, develop is 90 degrees off, and remains 90 degrees off compared with grid/loupe orientation even when rotating in grid or loupe.

    Have had this before, probably with NEF files, not sure. Don't remember how i fixed it then.

    Writing metadata to file did not help, nor did emptying cache, regenerating thumbnails, catalog check/backup, or simply exit/restart.

    What DID help is to remove photos from catalog, then syncing the folder. (I wrote metadata to the filesbefore removing them to make sure nothing got lost)

    Hope this is useful.
    Edwin
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Edwin, "nothing got lost" is not quite right, as you will lose edit histories with your fix.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • I’m frustrated that I had to redo all the orientations again and -- most of all -- cannot trust LR to preserve my work.
    Just a quick note that LR has lost the orientation data for some of my photos again (LR 3.4, Windows XP, 32 bit).

    Luckily not all catalogs were affected and within the one affected only a subset of the photos lost their orientation. Still sucks. :(

    I manually restored the orientation and saved the metadata to all photos. Here's hoping that it won't happen again.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • LR 3.5 has lost the orientation data for a subset of my photos again. This bug causes a lot of unnecessary work.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned