5 Replies Latest reply on Sep 21, 2010 12:16 AM by areohbee

    How do you Display a Scaled Photo in a Dialog?

    DyeHarder

      I'll admit I'm new to scripting in Lua/Lightroom and apologize if this is a trivial question.

       

      I'm attempting to write a plug-in to assist in a workflow for scanned images.

      The idea is to scan in the images and then use the plug-in to help process them

      efficiently by selecting options that I'll write specific code for.

       

      The plug-in will access a set of images selected from the Libraby module.

      In order for the plug-in to work effectively I need to display a preview/thumbnail

      of the image currently being processed in the plug-in's dialog box. I have successfully

      used viewFactory:picture to display the image, but it displays the image at full resolution

      which is way to big.

       

      Is there a way to use viewFactory:picture and scale the image down to a reasonable size?

       

      Is there a way to access the lower resolution preview images that already exist in Lightroom?

       

      Is there a way to do this that I am missing?

       

      I'm currently using Lightroom 2.5. The dialog I'm attempting to design would look a lot like

      the one provided in the Library module in Metadata -> Edit Capture Time, with my own

      workflow logic options.

       

      Many thanks to anyone who can point me in the right direction.

        • 1. Re: How do you Display a Scaled Photo in a Dialog?
          areohbee Level 5

          DyeHarder,

           

          I too would love to know how to tap into the Lightroom preview system to pull out already rendered images, but so far I haven't figured it out nor heard from anyone who has.

           

          In the mean time, one can effect which image is displayed in the lightroom navigator / thumbnails simply be selecting it using catalog:setSelectedPhotos( mostSelected, others ).

           

          This is a nice little function - may even be better than displaying a thumbnail in your plugin(?)

           

          Say: Have you learned which resource types are supported in the view-factory:picture function? - seems the documentation leaves it as an exercise for the user to figure out.

           

          Rob

          • 2. Re: How do you Display a Scaled Photo in a Dialog?
            johnrellis Most Valuable Participant

            The author of LrViewer has apparently reverse engineered how LR 2 and 3 store previews:

             

            http://imageingester.com/LRViewer-info.php

             

            I glanced at his site and didn't see any disclosure of the details.

            1 person found this helpful
            • 3. Re: How do you Display a Scaled Photo in a Dialog?
              areohbee Level 5

              Hi John,

               

              I took a look at an lrprev file - looks like standard jpeg image(s) in some kind of non-standard envelope. If you rename it .jpg or .tif then ACDSee will open it and display the thumbnail.

               

              I didn't look at the database files that go with it, but they might reveal something if one had a look.

               

              Anyway, LrViewer certainly proves the previews are accessible if one troubles to figure out how.

               

              The original poster could even try setting one of the lrprev files as a resource (maybe with a better suffix, like jpg or tif) and see if view-factory:picture would displays the thumbnail. One would still need to figure out how to get the right one though - that's where taking a peek at the database might come in handy.

               

              That's all I got,

              Rob

              1 person found this helpful
              • 4. Re: How do you Display a Scaled Photo in a Dialog?
                DyeHarder Level 1


                Thanks for the help Rob and John.

                 

                I was hoping that I simply missed the "supported" way of doing this.

                As my first Lightroom plug-in project has gotten more difficult than I

                had hoped, I think I'll modify my requirements so I can accomplish

                my objectives without having to do any nasty reverse engineering.

                 

                I may revisit this later to see what I can figure out when I have more

                time for experimentation.

                 

                Thanks again guys.

                • 5. Re: How do you Display a Scaled Photo in a Dialog?
                  areohbee Level 5

                  Hi DyeHarder,

                   

                  You're welcome, for what it was worth...

                   

                  Just don't forget about catalog:setSelectedPhotos - given what I gleaned from your original post, it'll do exactly what you want, even if not the way you had originally thought about it. For example, I rely on this method for my alternative keyword entry feature in my "Keyword Consolidator" plugin - so the user can see (in Lightroom proper) which image they're keywording in my plugin's modal dialog box.

                   

                  Cheers and good luck,

                  Rob