6 Replies Latest reply on Jun 14, 2012 2:21 AM by areohbee

    Using jpeg_limitSize


      Hi all,


      I'm having trouble getting the "LR_jpeg_limitSize" option to work when using an LrExportSession created in a script, in LR4.0 and 4.1 . I've not tested in older versions yet.


      It doesn't seem to matter what values are assigned, the size limit is never enforced. I've been varying what seem to be the relevant parameters - namely LR_jpeg_limitSize, LR_jpeg_useLimitSize and LR_jpeg_quality but only varying the quality value makes any difference to the resulting file. Not setting quality at all seems to make it use a default value of 0.6, but still not honour the limitSize value.


      Does anyone have any experience of this? It works as expected when exporting from the GUI, but not from a script.




        • 1. Re: Using jpeg_limitSize
          areohbee Level 6

          Consider looking at source code here, which does something similar:




          But, in a nutshell:


          * Dump the export parameters using something like Debug.lognpp from John Ellis debug toolkit.

          * Look for the option that enables the LR_jpeg_limitSize paramater to do it's deed.




          * Save an export preset that has the limit size enabled.

          * Save an export preset that has the limit size disabled.

          Compare them



          • 2. Re: Using jpeg_limitSize
            jimkeir Level 1

            Hi Rob,


            Thanks - already done those though, unless I'm missing something obvious. The key difference appears to be the 'LR_jpeg_useLimitSize' value, a boolean. To be specific, I've tried:


            - Passing through the existing table of parameters from the exportContext, but this doesn't work entirely correctly due to a bug in LR which someone reported in another thread, and Eric confirmed.

            - Copying that table verbatim into a new, non-observable table and passing that in.

            - Constructing an entirely new parameter table with LR_jpeg_limitSize and LR_jpeg_useLimitSize set appropriately

            - Ditto, but with LR_jpeg_quality set to 1 as per the example in the SDK, in case it works as some kind of trigger

            - Constructing a new parameter table with the only the values in a working saved preset (with LR_ prefix of course)

            - Passing in both the original and copied property tables without the LR_jpeg_quality value set, again in case this acts as a trigger to disable the limitSize value

            - Trying much lower size values, in case there's some kind of bug where the size is interpreted differently by the GUI and manual ExportSession creation


            In other words, if I use a pre-created ExportSession, it is obeyed. If I take that set of parameters, copy them into a new parameter table and create a second ExportSession by hand, it is ignored.


            Thanks for the reference to your existing code, but I'll not take a look since this is a bugfix for a commercial module and I try to avoid using sources that people have provided for free, out of respect for your time.




            • 3. Re: Using jpeg_limitSize
              areohbee Level 6

              I guess I don't know then.


              I've never had a problem with:


              local es = LrExportSession{ photosToExport=photos, exportSettings={

                   -- whatever I want, e.g. LR_this = that...





              But maybe you've stumbled into a bug I'm not aware of.


              Good luck,


              • 4. Re: Using jpeg_limitSize
                areohbee Level 6

                Dunno if export-percent-resize is the best example, now that I think about it: It doesn't create the export session in the above-mentioned manner (it's an export filter).


                But you can look at the exportTif function in the NxToo.lua module of the NxToo plugin, which does something more like what you are trying to do I think:



                • 5. Re: Using jpeg_limitSize
                  jimkeir Level 1



                  OK, thanks, I'll take a quick look and see if anything looks different. Incidentally, setting the export width and height in a filter no longer works either. I know it used to. Now all images are scaled to the height that's set when the first call to waitForRendition() in the filter is called, that's what triggered this whole thing off. I need to scale differently per-image and the only usable workaround is to create one exporter per image.




                  • 6. Re: Using jpeg_limitSize
                    areohbee Level 6

                    Post code snippet and perhaps somebody can see the problem?