• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
3

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

Community Beginner ,
Jul 13, 2013 Jul 13, 2013

Copy link to clipboard

Copied

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.

Views

55.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2013 Oct 24, 2013

Copy link to clipboard

Copied

This post was great!  Thank you so much.  But I am hoping you know one more thing related to this.  In the "transform" section of the definition (where the x/y coordinates are set along with height and width) there is an option called "angle".  I was hoping that changing this value would allow me to offset the angle of the picture.  However, if I put any value there other than 0 the template becomes unusable.

Do you happen to know what this option does?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 24, 2013 Oct 24, 2013

Copy link to clipboard

Copied

DHWachs wrote:

This post was great!  Thank you so much.  But I am hoping you know one more thing related to this.  In the "transform" section of the definition (where the x/y coordinates are set along with height and width) there is an option called "angle".  I was hoping that changing this value would allow me to offset the angle of the picture.  However, if I put any value there other than 0 the template becomes unusable.

Do you happen to know what this option does?

I haven't looked into the files, so this is just a guess based on how some graphic applications work. It's common to think of rotating a shape as pivoting around a center point, but It's possible that the file sets a value for the rotation point not at the center. In some graphics applications, you can set a shape's pivot at any corner or in the middle of any side, of the rectangle that contains the whole shape.

So, your value may be rotating the shape around a pivot that moves the shape into some area that upsets the behavior of other shapes. Just a thought.

HTH

Regards,

Peter

_______________________

Peter Gold

KnowHow ProServices

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 24, 2013 Oct 24, 2013

Copy link to clipboard

Copied

peter at knowhowpro wrote:

DHWachs wrote:

This post was great!  Thank you so much.  But I am hoping you know one more thing related to this.  In the "transform" section of the definition (where the x/y coordinates are set along with height and width) there is an option called "angle".  I was hoping that changing this value would allow me to offset the angle of the picture.  However, if I put any value there other than 0 the template becomes unusable.

Do you happen to know what this option does?

I haven't looked into the files, so this is just a guess based on how some graphic applications work. It's common to think of rotating a shape as pivoting around a center point, but It's possible that the file sets a value for the rotation point not at the center. In some graphics applications, you can set a shape's pivot at any corner or in the middle of any side, of the rectangle that contains the whole shape.

So, your value may be rotating the shape around a pivot that moves the shape into some area that upsets the behavior of other shapes. Just a thought.

HTH

Regards,

Peter

_______________________

Peter Gold

KnowHow ProServices

Peter's point is a good one.  I would also assume that the "angle" property allows you to rotate an image, but I haven't tried it myself.  One thing to investigate - are there any page templates included in LR that have image placeholders that are at an angle (I don't recall any, off-hand)?  If so, looking at the associated .lua file could provide insight into how an angled image placeholder should be described.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2013 Oct 25, 2013

Copy link to clipboard

Copied

Unfortunately, there are no image placeholders in all of LR5 for which the pictures are at an angle.  Nor can I find any LUA files which contain an "angle" parameter with a non-zero value.

So far I've tried several values large and small (I've even tried decimal values) but everything causes the template to be no good.

There must be someone out there that knows what all the values in the LUA files represent.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 15, 2013 Nov 15, 2013

Copy link to clipboard

Copied

Thanks for telling how to make templates for a book in Lightroom. I was surching for it a long time. And I am gratefull that it works.

Please can you tell me where Lightroom 5 makes the new template when you saved it 'as a custom page'  I want to change something in that new template but I cannot find where is has been saved.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 21, 2013 Nov 21, 2013

Copy link to clipboard

Copied

In LR choose the menu "Edit" -> Preferences -> Presets-tab -> Show Lightroom Presets Folders

Probably this will open a folder \AppData\Roaming\Adobe\Lightroom\

There you will find the folder "Layout Templates" containing your custom layouts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 27, 2013 Nov 27, 2013

Copy link to clipboard

Copied

Thanks for your answer, but that is the folder where templates are saved, but the new-made-templates are not there

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 28, 2013 Nov 28, 2013

Copy link to clipboard

Copied

I have two folders ... the LR-tamplates are in

"%PROGRAMFILES%\Adobe\Adobe Photoshop Lightroom 5.2\Templates\Layout Templates"

and my custom templates in

"%APPDATA%\Adobe\Lightroom\Layout Templates" (which is the same as above)

and I could edit templates in both folders (and it worked).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 29, 2013 Nov 29, 2013

Copy link to clipboard

Copied

Thanks a lot schleifi ! I found it! Then I can use them again ...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 13, 2013 Dec 13, 2013

Copy link to clipboard

Copied

Great findings Mr. MVulovic!

Would it be possible to post some standard format templates like A4 which are hardly missing?

Just a file which can be imported to the preference folder.

That would be very helpful.

Thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 13, 2013 Dec 13, 2013

Copy link to clipboard

Copied

Senhay-

I am not sure what printing capabilities Blurb has - they may not support A4 page sizes in photo books.  In any case, I do not have any A4 pages created, so I am sorry that I cannot help you.

-Marko

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 13, 2013 Dec 13, 2013

Copy link to clipboard

Copied

Unfortunately LR 5 is not offering any standard formats that are in use in europe and in a lot more countries worldwide.

Because of different aspect ratios there is no work around.

This is to bind the Adobe Customer to the ridiculously high priced blurb service. The prices are the double other providers (germany) charge for the same book.

Worst example is a shipping fee of Euro 17,90 for an express service which is as fast as a local service which only charges 2,95 for the same.

You´ll get this displayed at the end of the ordering process!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

Not an expert but would it not be possible to modify the entire templates to fit your needs by applying a change and replace on the sizes and positions using a the ratio of your pages, e.g. replace "height = 909" by "height = 0.3 * 909"? One would only need to replace "height = ", "Height =", "x =", "y =", etc. You should be able to keep all the positions and sizes of the templates this way. One would need to change the size also in the main template LUA file.

I would however make a backup of the templates and keep the files names. You would then need to keep in mind the actual templates sizes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

I’m not sure if you can change the built-in templates in LR5 with ease, but this is an interesting thread. In LR Classic it is now possible to create and save your own custom pages and the latest version 8.1 has the ability to snap to grid, making layout more accurate.

I have a quick video demo:

https://youtu.be/o0BuVyoB7N8

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 17, 2018 Dec 17, 2018

Copy link to clipboard

Copied

Thanks. That is indeed a useful feature. At my stage, I am already happy with the layout templates book module.

What I do not like is to be limited in the page and cover sizes (all in US and blurb format). I hope that by modifying the LUA using the above method, I could generate PDF books that I can submit to another photo service (WhiteWall in my case). They use the metric system and provide on their webpage the full sizes of their pages and covers (in descriptions similar to what Blurb uses: “Standard Landscape”; “large landscapte”, etc).

WhiteWall is cheaper for the EU and they have actual shops in a few cities.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 22, 2014 Jan 22, 2014

Copy link to clipboard

Copied

Great idea! I was finding for it!

If you excuse my poor english, i try to explain a more simple way to do it.

The first is to create a 'custom page' from the standard page you want.

Then you have, in the custom folder (User\app....\Lightroom\Layout Templates\10x8-blurb(or other), a folder 'custompage...' with the 'templatePages.lua' file for your custom page and a jpg file with the preview.

Now you can modify the lua file as MVulovic has explained and the jpg as you want to look like the page.

If you create another custom page for the same dimension book, this is added to the lua file, then you can modify also this one as the first.

In this case you have to do no modify at the original page template.

I hope to haven't write too bad, and to has been helpful.

Tanks

Piero

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 13, 2014 Sep 13, 2014

Copy link to clipboard

Copied

Hello,

I'm very interested in building new templates for Lightroom 5 and have been following the description on this thread.

I found the necessary files and tried editing them.  They should just be Lua script, but instead found binary files.

Below is a screenshot from CodeRunner looking at the file located here:

/Applications/Adobe Photoshop Lightroom 5.app/Contents/PlugIns/layout_toolkit.agmodule/Contents/Resources/13x11-blurb/wedding13x11

I was unclear if this was an odd encoding format or a binary version of Lua.  On further research, Lua is an compiled byte-code language (much like Java).  It can run directly from script but is compiled to byte-code at runtime and runs in a virtual machine.  I found a Lua decompiler (unluac) and was able to decompile the binary to Lua script code.  See second image.

So apparently, Adobe is now storing these Lua files in byte code and not in script form any more.

Did this change recently?

Are there any editors or IDEs that can work directly in Lua byte-code?

Have any others seen this problem?  Is it Mac only?

-Kevin

Screen Shot 2014-09-13 at 2.26.12 PM.pngScreen Shot 2014-09-13 at 2.42.22 PM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 13, 2014 Sep 13, 2014

Copy link to clipboard

Copied

Well, I'm pleased to report, that one can replace the binary-Lua with script-Lua and it will work.

In other words, the following works:

- copy the original templatePages.lua file to a safe name, something like templatePages_orig.lua

- decompile the templatePages.lua file (which is binary-Lua) using unluac.

    $ java -jar unluac.jar templatePages.lua

- save the new lua-script to a lua file named templatePages.lua

   - On a OSX, I used sudo to open the editor from in the proper directory, so I could save directly

- open LightRoom5 and it will use the lua-script file.


I confirmed this by modifying the templatePages file and the mods showed up in the LR.

Good luck.

-Kevin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 15, 2014 Sep 15, 2014

Copy link to clipboard

Copied

I followed a similar process to define my custom templates. You create a new custom template by 'only' temporary modifying the predefined set. I opted for a separate set of templates (which also takes out the issue of modifying delivered code) which appear under their own group in the layout panel:

Book Template Selection.jpg

You can add (per book size) a new folder and a description file in (e.g.) C:\Users\XXXXXX\AppData\Roaming\Adobe\Lightroom\Layout Templates\12x12-blurb. That is also the location where the custom pages are stored, the content of the file and folder can be borrowed from those:

You'll need to define your own unique id's, however, Lightroom does not seem too picky concerning that.

As I made left and right version (only different margins) I added a clear L/R indicator to the jpg's found in custompages12x12-blurb. And moved those to my own set in vakantie12x12 and referencing them in the local templatePages.lua.

I hope this helps others to create their own set of templates.

Diederick

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 22, 2014 Sep 22, 2014

Copy link to clipboard

Copied

Is there any trick to getting lightroom to recognize the customized layout groups?  I am trying the same approach on a Mac, and can get modifications to the custom templates working, but could not get a custom group to be recognized for anything.  I'm putting the files in the user/library/.../ directory I found the custom layouts file in from lightroom.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 24, 2014 Sep 24, 2014

Copy link to clipboard

Copied

There will be a folder custompages10x8-blurb (with two or more files) as well a file custompages10x8-blurb.lrtemplate (or a different format id like 12x12). You need to modify both with respect to name as well as content (for the text files). Start with replacing 'custompages' to an identifier sensible to you. Here in this example I changed it to 'mypages'. I have now the files/folders:

mypages10x8-blurb.lrtemplate

mypages10x8-blurb

mypages1411562662_preview.jpg

templatePages.lua

Change also in the two text files custompages to mypages. The value of hints => bookTitle (in de lua file) is the choice in the dropdown in the UI, so a human understandable entry.

Stop and start Ligthroom to make it active. The Custom Pages options is gone and your renamed entry should be there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 24, 2014 Sep 24, 2014

Copy link to clipboard

Copied

Thanks for the instructions - but they don't seem to be working on my Mac.  No matter what I do, it only will show up with the 'Custom Pages' entry in there - it seems to disregard the name all together.  I wonder if there is something extra about the Mac version of lightroom that it isn't scanning the directory, but only loading specific files. 

If anybody has custom named template collections working on a Mac, please let me know.

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 25, 2014 Sep 25, 2014

Copy link to clipboard

Copied

Sorry to hear that you can not get it to work. I did actually do this on a Mac with LR 5. So, it seems that I did make myself clear enough, or forgot to mention a step. But, it certainly did work... [I am not 'native' to Mac.]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 06, 2014 Oct 06, 2014

Copy link to clipboard

Copied

Question that is a bit different than your original post, but you seem to know the "template" issue. Was about to print photos using LR 5 and out of curiosity I clicked on "lightroom templates". Didn't like it and decided to just print the simple 4x6 borderless photos on my printer but now every time I try to print, it prints to the "lightroom template" that I previously chose. I can't seem to clear out the selection. I know I can't delete the lightroom templates but how do I clear the selection so I can print the way I want to?

J

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines