5 Replies Latest reply on Feb 10, 2014 10:09 AM by johnrellis

    What is root-pixels.db used for?

    areohbee Level 5

      I mostly understand previews.db, but root-pixels.db is still a mystery - any ideas?

       

      I mean it seems like redundent info from previews.db, plus jpegData which only has like 10 bytes of data - hmm...

        • 1. Re: What is root-pixels.db used for?
          jarnoh Level 1

          Actually, the jpegData field contains first level of the image pyramid.  I guess it is kept as a quick thumbnail when the image pyramid is being re-rendered.

           

          Personally, I'm not using previews.db for anything.  I made a QuickLook plugin (http://capturemonkey.com/quicklook-lightroom) which shows the catalog contents, but I'm only using lrcat file, taking the UUID and latest development settings digest and trying to load corresponding file from the preview folder.

          1 person found this helpful
          • 2. Re: What is root-pixels.db used for?
            areohbee Level 5

            Thanks jarnoh,

             

            It was a real trick for me to get the jpeg data in a useable form (using quote(columnName) syntax then translating format):

             
            local sql = str:fmtx( "select quote(jpegData) from RootPixels where uuid='77833B11-7D7C-4F8C-BE57-805DB25657D9'" )
            local imageData, errm = sqlite:query( db, sql, 0 ) -- zero => return raw data.
            if not imageData then
                app:logWarning( "sql query error: ^1", errm )
                return nil
            end
            
            local b = {}
            for i = 3, #imageData - 3, 2 do -- good stuff is in-between X' and trailing '.
                local c1 = imageData:sub( i, i )
                local c2 = imageData:sub( i + 1, i + 1 )
                local c = tonumber( c1..c2, 16 )
                app:assert( c ~= nil, "nil at ^1: ^2/^3", i, string.byte( c1 ), string.byte( c2 ) )
                b[#b + 1] = string.char( c )
            end
            local jpegData = table.concat( b, "" ) 
            

             

            If anybody knows a better way (to get binary data from database, e.g. in the form of a lua string) - I'm all ears.

             

             

            PS - I guess you only need the preview database if you'll be dealing with icc profile and such stuff.

             

            Thanks again,

            Rob

            1 person found this helpful
            • 3. Re: What is root-pixels.db used for?
              areohbee Level 5

              To summarize:

               

              root-pixels.db contains small jpeg thumbnails for all photos in the catalog - e.g. presentable in Lr grid view.

               

              Worth noting: previews.db contains no image data, so to present the larger thumbs / previews Lr needs to read the db and the pyramid files on disk, whereas the smaller previews in root-pixels.db are accessible with greater efficiency.

               

              Rob

              • 4. Re: What is root-pixels.db used for?
                areohbee Level 5

                My previous post (#3) was marked 'Correct', but now I've un-marked it. I mean, nothing in it is wrong, that I know of, but the original question still remains. - I just wrote a test to delete selected previews from preview.db, but NOT from root-pixels.db Now, nowhere that I can find is there a thumbnail being displayed - begging the question, is root-pixels.db a "write-only" database, or is there really some circumstance when they're read/used...

                • 5. Re: What is root-pixels.db used for?
                  johnrellis Most Valuable Participant

                  I just did a quick test with Sysinternals' Process Monitor, which logs all Windows kernel calls. As I scroll through Library view with medium-small thumbnails (12 per laptop screen), LR does read root-pixels.db, about 2 reads / 19K total bytes per thumbnail displayed.   So it is reading the file. 

                   

                  Your experiment suggests that if an image doesn't have data in preview.db, it won't use data from root-pixels.db.  But what if you go the other way -- delete the image's data from root-pixels.db but not preview.db?