8 Replies Latest reply on Apr 1, 2016 4:27 PM by Giuseppe Covino

    modify export settings on a photo basis

    Giuseppe Covino

      Hi All, I searched a lot without finding an answer to this task: I need to change export settings on a single photo basis, for example settings megapixels resize factor depending on rating.

      I know export settings can be changed with updateExportSettings but this is global for all photos.

      I also know that in the Export Service I can define a processRenderedPhotos function where in the loop inside session:renditions I can do additional actions on each photo but after having been rendered.

      I finally know I can define a Filter Service where to put postProcessRenderedPhotos function, but this is a postProcess function so after the photo has been rendered and saved...

      So... how to do that? Where to put some code for changing exportSettings for each photo based on some characteristic of the photo?
      Thanks a lot for your help

       

      Giuse

        • 1. Re: modify export settings on a photo basis
          johnrellis Most Valuable Participant

          I haven't tried it, but the API Reference for LrFilterContext says that the "filterSettings" parameter to filterContext:renditions() can be a function that modifies the export settings of an individual photo before the photo is rendered. See the code sample on page 49 of the Lightroom SDK Guide.

          • 2. Re: modify export settings on a photo basis
            Giuseppe Covino Level 1

            Thanks a lot John, but I can't understand two aspects:

            • how to access each photo in the function "filterSettings = function( renditionToSatisfy, exportSettings )"...? As I said, I need customizing the exportSettings based on individual characteristics of the photo, so I need the access the photo associated to current rendition: how?
            • this hook placed into the postProcessRenderedPhotos does intercept photos before Lightroom rendering, but makes a post process action to appear in the lower "Post Process" list in the Lightroom export dialog and the user must click on it, then "Insert" it to finally make it active. Is there a way to automatically enable/insert it when selecting the plugin in the upper plugin list?

            thanks a lot!

             

            Giuse

            • 3. Re: modify export settings on a photo basis
              johnrellis Most Valuable Participant

              how to access each photo in the function "filterSettings = function( renditionToSatisfy, exportSettings )"...? As I said, I need customizing the exportSettings based on individual characteristics of the photo, so I need the access the photo associated to current rendition: how?

              The "renditionToSatisfy" argument is of class LrExportRendition, and renditionToSatisfy.photo yields the LrPhoto being rendered.

              • 4. Re: modify export settings on a photo basis
                johnrellis Most Valuable Participant

                this hook placed into the postProcessRenderedPhotos does intercept photos before Lightroom rendering, but makes a post process action to appear in the lower "Post Process" list in the Lightroom export dialog and the user must click on it, then "Insert" it to finally make it active. Is there a way to automatically enable/insert it when selecting the plugin in the upper plugin list?

                It appears that the export-settings property LR_exportFiltersFromThisPlugin (page 69) specifies which filters are enabled.  For plugin-defined export settings, you can set initial default values via the "exportPresetFields" property of the service definition (page 60).  It's not clear whether you can include in that table default values for Lightroom-defined export settings, e.g. LR_exportFiltersFromThisPlugin, but it's worth a try.  Or perhaps there's another way to define an initial default value for LR_exportFiltersFromThisPlugin that I'm missing.

                • 5. Re: modify export settings on a photo basis
                  Giuseppe Covino Level 1

                       local foto = renditionToSatisfy.photo

                  throws me error: attempt to index global 'photo' (a nil value)

                  am I doing something wrong?

                  cheers and thanks

                   

                  Giuse

                  • 6. Re: modify export settings on a photo basis
                    johnrellis Most Valuable Participant

                        local foto = renditionToSatisfy.photo

                    throws me error: attempt to index global 'photo' (a nil value)

                    I don't think that error is coming from the line you provided.  The error would come from an expression such as "photo.field" from some field that's not defined for "photo'. 

                    • 8. Re: modify export settings on a photo basis
                      Giuseppe Covino Level 1

                      Hi, one last question: how and where would I set the LR_exportFiltersFromThisPlugin property? Inside the exportfilter? Inside a startDialog function?

                      Since it is a table with (extract from the manual): "Table with a key that is the ID of each enabled filter, and a corresponding value that is the index of that filter in the overall filter stack." something like

                       

                           exportSettings.LR_exportFiltersFromThisPlugin = {filterName = 1}

                       

                      or in another form?

                      thanks again!

                       

                      Giuse