5 Replies Latest reply on Mar 29, 2017 12:41 PM by kimaldis

    Generating resized images in a publishing service.

    kimaldis Level 1

      I have a publishing services, sends images to a web site over FTP with some xmlrpc mixed in. I need resized versions of the images for thumbnails, full screen, etc. I've been generating them on the site but I'm running into CPU limit issues with my hosting service so I need to generate them locally and send. There doesn't seem to be an immediate way to do this within Lightroom. I can do it easily enough using ImageMagick but that seems daft given where I'm doing it. Have I missed something terribly obvious?

        • 1. Re: Generating resized images in a publishing service.
          johnrellis Most Valuable Participant

          Use LrExportSession() to export resized photos.  To construct the "exportSettings" table parameter, create and save an export preset in the UI.  Copy the settings from there, prefixing each key with "LR_", e.g. change "maxHeight" to "LR_maxHeight".

          • 3. Re: Generating resized images in a publishing service.
            kimaldis Level 1

            An addendum for those that might try this. Resizing using an Exportsession works but it's turning out to be impractical and I think I'm going to have to revert to ImageMagick. I'm creating 4 versions of each published image with between 30 & 120 images in each collection and the time & CPU overhead is pretty high. I'd imagine it has to do with each resize being performed on the full res RAW image and these are quite large (Sony, A7RII). ImageMagick I can generate resizes from each previous resize and it's a whole lot quicker. I can post the code, both versions, even,  if it's of interest to anyone.

            • 4. Re: Generating resized images in a publishing service.
              johnrellis Most Valuable Participant

              It may not matter for your application, but using ImageMagick for the largest version of the image won't pick up any changes made in Develop.

               

              Also, whether you're using Export or ImageMagick, you may well get significant speedups by using LrTasks.startAsyncTask() to run multiple exports/resizes in parallel. 

              • 5. Re: Generating resized images in a publishing service.
                kimaldis Level 1

                I mis-explained. I'm resizing the jpeg image generated for the publish service so picking up develop settings isn't an issue. I'm using ImageMagick's clone option, generating each subsequent downsize from the previous. It's between 3 & 4 times faster than using Lightroom and the memory overhead is less. I had to set a task count limit to stop asynctask calls running wild but otherwise I'm getting a significant speedup by resizing externally.

                 

                I'm using FTP to upload so I'm already running these in a task. Task count needs limiting, though, to prevent the server transfer limit being exceeded.

                 

                FWIW: this was an experiment in using FTP to publish images to Wordpress, as opposed to xmlrpc. It's faster and significantly more reliable.