Generate layout templates for the Book module in Adobe Lightroom Classic.
It is very hard to create layouts with consistent margin and gutters in Adobe Lightroom Classic’s Book module.
LayoutGenerator
creates layout templates with your desired margin and gutters, allowing you to design books with consistent page layouts, regardless of the number of images on each page.
Use the following commands to set up LayoutGenerator
.
Download LayoutGenerator
:
git clone -b v1.0.0 --depth 1 https://github.com/Stadly/LayoutGenerator.git
Install dependencies:
pip install -r LayoutGenerator/requirements.txt
Change working directory:
cd LayoutGenerator/src
It is also possible to set up and use LayoutGenerator
in a docker container instead of installing it locally. See the section Using Docker for details.
Run the python file generate.py
to use LayoutGenerator
.
LayoutGenerator
can be used to generate layout templates for 9 different book types:
- Small Square
- Standard Portrait
- Standard Landscape
- Large Landscape
- Large Square
- Blurb Magazine
- Trade Book 8x10
- Trade Book 6x9
- Trade Book 5x8
Specify your book type to generate layout templates for it:
python generate.py 'Standard Landscape'
By default, the template files will be stored in your current working directory. To set a different output directory, use the -o
or --outdir
argument.
The output directory should be set based on your operating system:
- Windows:
C:\Users\[user name]\AppData\Roaming\Adobe\Lightroom\Layout Templates
- macOS:
/Users/[user name]/Library/Application Support/Adobe/Lightroom/Layout Templates
python generate.py 'Standard Landscape' -o /my/output/directory
Use the -m
or --margin
argument to set page margins. Specify from 1 to 4 integers to get your desired result:
- 1 number:
-m A
. All margins are set toA
. - 2 numbers:
-m Y X
. Top and bottom margins are set toY
, left and right margins are set toX
. - 3 numbers:
-m T X B
. Top margin is set toT
, left and right margins are set toX
, bottom margin is set toB
. - 4 numbers:
-m T R B L
. Top margin is set toT
, right margin is set toR
, bottom margin is set toB
, left margin is set toL
.
Use the -g
or --gutter
argument to set the gutter between images. Specify 1 or 2 integers to get your desired result:
- 1 number:
-g A
. All gutters are set toA
. - 2 numbers:
-g V H
. Vertical gutters are set toV
, horizontal gutters are set toH
.
Use the -r
or --ratio
argument to set the ratio between the width and height of the layouts. With a ratio of 2/3, the layout width will be 2/3 of the layout height. If you specify a ratio of 1, square layouts will be generated. The page margins are automatically adjusted to account for the difference between the chosen layout ratio and the ratio of the book pages.
python generate.py 'Standard Landscape' -r 3/2
Inside Lightroom Classic, the generated layout templates will be available in a template collection. By default, the collection will be named based on the margins, gutters and ratio of the layout templates. To set a custom name, use the -n
or -name
argument:
python generate.py 'Standard Landscape' -n 'My layout templates'
Any logging output generated by LayoutGenerator
is written to stderr
. There are five levels of logging:
- debug
- info
- warning
- error
- critical
By default, info
and higher log messages are output. Use the -l
or --log
argument to specify which levels of log messages to output:
python generate.py 'Standard Landscape' -l debug
Docker makes setting up and using LayoutGenerator
really easy. All you have to do is build the docker image, and you can use LayoutGenerator
without installing any dependencies (even Python!) locally.
Build the docker image using the following command.
docker build -t generate-layout .
After the image is built, just run it to use LayoutGenerator
. The syntax when running LayoutGenerator
inside the docker container is the same as when running it locally, except that python generate.py
is replaced by docker run generate-layout
.
In addition the --output
argument should not be used. The output directory is instead specified using volume mounting. In order for the docker container to be able to access the location where the layout template files should be stored, the output directory must be mounted to the docker container. Use the -v
or --volume
argument and specify the absolute path of the output directory, followed by :/output
.
For example, the following command will generate layout templates for the book type Large Square
, with margins of 50 and gutter of 10, and store them at /path/to/templates
:
docker run -v /path/to/templates:/output generate-layout 'Large Square' -m 50 -g 10
If you want to mount a directory using a relative path, you can use $(pwd)
to denote the current working directory:
docker run -v "$(pwd):/output" generate-layout 'Large Square' -m 50 -g 10
Please see CHANGELOG for information on what has changed recently.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License file for more information.