1 2 Previous Next 48 Replies Latest reply on Oct 30, 2017 12:40 PM by sssanti1

    A method to create completely customized photo book page templates from scratch in Lightroom 5

    MVulovic Level 1

      I was able to successfully create completely customized Lightroom 5 page templates (including altering the number of, positions, and sizes of pictures) by making edits to the templatePages.lua file(s) in the Lightroom directory tree.  I have never heard of the LUA file format before, but it is ASCII and looks somewhat like XML, so it was fairly easy to decipher.  Here is a high-level description of how I did it.  This applies to Lightroom 5 on Windows 7.  If this doesn't make any sense to you, then don't try it - you're likely in over your head.  Although my description is brief and lacking in detail, it should enable someone who is capable of handling this to figure it out with a little of careful trial and error.  Do this at your own risk - if you screw-up your installation, catalog, or computer, it's your own fault.  It all worked great for me.



      First, open the "<lightroom 5 install directory>\Templates\Layout Templates" folder.  Then navigate to the template set that contains the template you would like to use as a starting point for the new template.  For example, "12x12-blurb\clean12x12".  Make a back-up copy of the templatePages.lua file in case you mess something up and want to revert.



      There will be a bunch of .jpg files in this directory that each contain a preview image of the layout that carries the same name as the .jpg file.  Find the one that you would like to use as a starting point.  Take note of the name of the file, which is probably something similar to "page_26_preview.jpg".   Duplicate the file and rename it to something unique, such as "dummy_preview.jpg".  It's just temporary, so it doesn't matter what name you pick, provided it is a legal file name with no spaces.



      Next, open the templatePages.lua file in a text editor.  I suggest using one that can automatically recognize and format ULA (such as Notepad++, which is open source and free to use).  Then search the file for the unique portion of the file name you took note of earlier, such as "page_26".  It will point you to a section in the LUA file that describes that particular template.  Carefully copy that entire section, including a balanced number of brackets (starting with the two brackets and commas before "children" and ending with the one bracket and comma after the "title" line.  Paste the copied text into the end of the file on a new line immediately following the bracket and comma after the "title" field for the last page template section (right near the end of the file).  Change the "previewName" field to the name of the preview file copy that you created ("dummy_preview.jpg" for me) and the "name" field to the name of the new template you're creating ("dummy" for me, since it is just temporary).  Next change at least one of the hex characters in the "pageID" field such that the new template will have a unique page identifier.



      Now you can make edits to the photo and text fields included in the new section, using other templates in the template file as examples.  "x" and "y" fields are coordinates (in pixels) for the bottom-left corner of the picture or text field, "height" and "width" are the width of the field in pixels.  The fields should be mostly self-explanatory, but make sure that the "photoindex" fields are filled-in starting from 1 to N, where N is the number of pictures in the template, with no duplicates or gaps.  They do not need to be in order.  Treat the "textIndex" fields similarly for text fields.  If you want to add an additional picture or text field, simply copy the section describing a picture or text field from another template and paste it, carefully, into the new template that you are creating.



      Once you are done, save the file (you may get interference from Windows UAC, in which case save the file elsewhere and the move it back to the correct directory).  Then open Lightroom.  Create a new photobook, and choose the new template for one of the pages, remembering that the preview image will look like the JPG that you copied.  Voila!  If you didn't screw anything up, you should see a page based on your new template.  Then right-click the page and select "Save as custom page", which will cause a fresh preview file to be created for your new template and your template to be copied to the "custom pages" section of the template menu.  The new section you added to the "templatePages.lua" and the "dummy" preview file can now be deleted, since they are no longer needed.  I save them so that I may simply overwrite them the next time I need to create a customized template.



      Enjoy, and please share any clarifications, corrections, or enhancements to my process.

        1 2 Previous Next