InDesign Photo Book Layout Scripts
Introduction
The tools described here are Adobe InDesign scripts that build a layout of graphic frames for photo placement. I wrote them because of dissatisfaction with the layout tools offered by the photo book printers including WinkFlash and Blurb.
- Photobook_Layout.jsx - Builds one layout on the current page or selected rectangle.
- Photobook_Library.jsx - Builds an InDesign library of layouts.
- Photobook_Reset.jsx - Resets dialog options to default values.
The tools include a number of features to meet the needs of photo book layout:
- Layout fit to page, fraction of page, or selected rectangle.
- Gap is fixed or proportional to cell size.
- Cell shape of specified aspect ratio, square, or using full available space.
- Generalized bleed to one or more edges.
- Regular grid or split-pane layouts.
- Split-pane layouts can have unique grid in each pane.
- Optional caption text frames under graphic frame.
- Optional guide lines aligned with edges of graphic and text frames.
- Minimal use of dimensions in absolute units.
The screen shots below show a couple of layouts made with the tools. More follow at the end of this page.
1x3 vertical split-pane, full area
2x2 landscape aspect
Background
When I first tried to put together a photo book using InDesign I quickly got bogged down computing the sizes of the the frames for various layouts and page sizes. While the computation for any one is simple, in the aggregate it got stale fast and I quickly abandoned this approach. I next set up an Excel spreadsheet to do the computation. That solved one problem but I still had to draw the layout, apply the computed dimensions, and use InDesign to distribute and align the frames. That's a lot of work to repeat with each new page size or to explore a new layout. It was about this time that I became aware of the scripting facilities in InDesign and so tried a third approach that led to the scripts presented here. I had some JavaScript experience in my prior life and so chose that for the scripting language.
I was guided by a several goals in developing these scripts.
- No manual intervention - I wanted the layouts to be useful as generated without requiring any manual intervention to align frames, make small adjustments in position, or any other sort of tweak.
- No manual computation - I wanted the layouts to fit automatically to any given page size. If I select a new photo book publisher with new page geometry I didn't want to have to do any new frame computations - the scripts should do it all.
- Minimal fixed dimensions - I wanted frame dimensions to be a result of computation based on page size, gap, and frame count, not a given input parameter. InDesign provides ample facilities for creating frames of specified size and position. These scripts should work at a level above that. There are two exceptions to this. The gap between frames can be given as a fixed amount or as a percentage. The fixed amount is best if you want to maintain a consistent gap independent of number of frames on a page or you want the gap to be the same as the margin. The height of the optional caption frame and gap between the photo and the caption frames are given only in fixed units. The alternative produced caption boxes of varying size depending on the number of frames vertically. This was not only unattractive but not very useful since the size of the font will ordinarily be the same in all captions.
- Quick image placement - I wanted to place images in the frames without the need for any further fitting operations. Since the Fill Proportionally is pre-selected, images matching the aspect ratio of the frame will fit perfectly. Images with a mismatched aspect ratio (4x6 placed into a square for example) may need to be manually adjusted for best cropping. (Note: You must set the Fill Frame Proportionally explicitly with CS5. More below.)
Installation
Download the tools:
Download the files and save in the following folder:
- CS3 and later - <InDesign_Install_Folder>\Scripts\Scripts Panel
- CS2 - <InDesign_Install_Folder>\Presets\Scripts
C:\Program Files\Adobe\Adobe InDesign CCor something similar for earlier versions of InDesign.
On CS2 insert two forward slashes in front of the second line in the script. (It's not worth maintaining two versions of the scripts that differ by only two characters in one line for the purpose of supporting an ancient version of InDesign.) Using Notepad or another text editor change:
#targetengine "PhotoBookLayout"to://#targetengine "PhotoBookLayout"
By placing the scripts in the folder as described above it will appear "Application" section of the scripts window. Alternatively, you can save it in another location to cause it to appear in the "User" section of the script window. Right-click on the "User" section and select "Reveal in Explorer" to obtain the location.
InDesign Version Compatibility
The scripts should work fine on Windows and Mac versions of InDesign from CS2 on.
I developed the scripts primarily on the Windows version of CS3 with only brief testing to establish overall compatibility on CS2, CS5, CS5.5, and CC. Others report that they work fine on CS6 and on a Mac. I'd appreciate confirmation that they work with CS4.
Menu-value persistence only works on CS3 and later. That is, the values you entered in a menu are remembered and presented the next time the menu is displayed. This is not possible on CS2.
Adobe documentation nonwithstanding, CS5 and CS5.5 does not appear to have a Fitting on Empty Frame option. This option, working in CS2, CS3, and CC, makes it possible to specify fitting options for an empty frame and is used by these scripts to automatically specify Fill Frame Proportionally. As a result, you should set the Fill Frame Proportionally option manually after you create a new document:
Object->Fitting->Frame Fitting Options...->Content Fitting->Fill Frame Proportionally
The option is associated with the document and remembered across InDesign sessions.
Work Flow
Photo Book Creation
If your photo book printer accepts PDF files you can create PDF files directly from InDesign.
- File->Export->Save as type: Adobe PDF
If your photo book printer does NOT accept PDF files, as is the case for WinkFlash at the time of this writing, then you must create a JPG image of each page set as a full bleed. InDesign CS3 and CS5 can export JPG files of arbitrary resolution.
- File->Export->Save as type: JPEG
Enter the resolution recommended by your book printer in the JPEG dialog box. This will create one JPG image per page with a name containing the page number.
InDesign CS2 can export JPG files in only one resolution, which is intended only for proofing and is far too low for book printing. With CS2 you need to export your document as a PDF file and then convert the PDF to JPG pages with another tool such as Adobe Acrobat.
To set up a full bleed obtain the full bleed and cut page dimensions from your photo book printer. For example, a WinkFlash 10x8 book has a full bleed size of 11.5" x 8.5" and a cut page size of 11.3" x 8.3". In the InDesign New Document dialog set the Page Size to the cut page size and set the Bleed (Top, Bottom, Inside, Outside) to half the difference between the full bleed size and the cut page size, .1" for this example (half to distribute the bleed evenly).
The frames created by both tools have the Frame Fitting Options set to Alignment to Center and Fill Frame Proportionally. I find that this is most sensible for my needs.
Script Access
- CS5 and later - Window->Utilities->Scripts, DoubleClick on script name or RightClick->Run.
- CS2 & CS3 - Window->Automation->Scripts, DoubleClick on script name or RightClick->Run.
The figure below shows the entry for these scripts in the scripts window.
Library Access
- File->Open->Select library file (*.indt)
A Note of Caution
These scripts are designed to work with any page geometry whether it is landscape, square, or portrait. A layout that may look fine in a landscape format page, say one row by three columns, will look pretty bizarre when set on a portrait format page. Just because the scripts can generate a particular layout does not mean that it is a good layout. There probably is a place for a 1"x 5" photo but it's quite rare; a full page of them is even more rare.
Photobook_Layout.jsx
This script builds a layout according to parameters given by the user in the menu. The layout is built within the margins of the current page or within an arbitrary rectangle if one is selected, both possibly reduced by a given scale factor. Use a rectangle to build a layout across multiple pages in a spread. The layout uses the maximum available space subject to the constraints of the selected scale, aspect ratio, bleed and gap. Multiple frames in a layout are arranged in a group so that you can reposition them as an aggregate.
Double click on the Photobook_Layout.jsx script in the InDesign Scripts panel to bring up the layout dialog.
- Single/First (top/left) Rows, Columns - The grid dimensions for a single-pane layout (or for the top or left pane of a dual-pane layout).
- Draw Guides - Draw guides at the edges of the graphics frames and optional text frames. These may be helpful if you are adding content in alignment with generated frames.
- Bleeds - Extends the image to the limit determined by the document bleed setting for one or more edges. Any or all of the edges can be used with a Shape of Full. Select all four Bleed edges and a Shape of Full for a full bleed. With a Shape of Aspect Land, Aspect Port, or Square only one edge or two adjacent edges can sensibly be used. In this case also set the Hori Alignment and Vert Alignment options to align the image to the selected bleed edge.
- Layout scale (% available) - The size of the layout is reduced by the given factor from the total available on the page or selected rectangle. Use this option to leave more white space on the page or space for text beyond the simple captions provided by the tools. While this option has an effect similar to the page margin, it is more convenient to adjust this while keeping the margins constant for the entire document.
- Near margin (% of diagonal) - Near alignments (near left, near bottom, etc.) are offset from the corresponding margin by this amount. This produces pleasing layouts with ample white space when used together with a reduced Layout scale.
- Hori & Vert Alignment - Sets the alignment of layouts that do not completely fill the space between margins. In the general case this includes any shape but Full and all shapes at scales less than 100%. The Center and Near alignments are at cross purpose with the Bleed options and should not be used together.
- Gap - The gap between cells is be specified as a percentage of the cell size or as a constant. The constant is given in the document's default measurement unit or in other units by including the unit specifier (p, pt, in, etc.). (Note that the relative gap is based on the raw cell size determined by the space between the margins divided by the cell count, not the final cell size after gaps and aspect ratio adjustment.)
- Shape - The cell can be: Full - a rectangle filling the available space, possibly reduced by the Scale Factor, or extended by the Bleed options; Aspect Land, Aspect Port - a rectangle of the given aspect ratio; or Square. In the general case the square or aspect layouts will extend only to one of the two pairs of margins and will be aligned according to the Alignment option.
- Caption - A text frame is drawn below the graphic frame. The size of the frame and gap between the image and caption are given in measurement units.
- Split Pane - The page is divided into two panes, which can each contain one or more cells. All split-pane layouts include only the Full cell shape because, in the general case, the others will not produce alignment to the margins in both frames. You can still create any layout in each of the two panes by running the script again with each pane selected.
- Second (bottom/right) - The grid dimensions of the second pane, which is on the bottom or the right.
- Split - The panes are arranged side by side (horizontal) or one above the other (vertical).
- Second Pane - The size of the second pane as a fraction of the space between margins.
Photobook_Library.jsx
This script builds an InDesign library consisting of one or more layouts. The layout is built within the margins of the current page, which should be constant throughout the document for the library to be useful. Each layout includes a frame of the size of the page plus bleed. Align this frame with the edges of the bleed when you drag the library item from the menu onto the page. This frame is on the bottom of the stacking order, is necessary to preserve the alignment of frames on the page, and can be used as a frame to receive a background image.
This script does not yet support the bleed options in the layout script.
Double click on the Photobook_Library.jsx script in the InDesign Scripts panel to bring up a file-selection dialog and then the layout dialog.
By default the script builds multiple single pane and split pane layouts, and one full bleed layout, all centered. Un-check options to restrict the library from the default. The Gap, Caption, Scale, Near margin and Alignment options are the same as described above.
For the single-pane case the script builds a layout for all combinations of the selected options.
For the split-pane case the larger pane (or one of the equal panes) always contains a 1x1 layout, the smaller pane (or other one of the equal panes) contains a 1xN layout where N is given by the Max rows or cols option. All split-pane layouts include only the Full cell shape because, in the general case, the others will not produce alignment to the margins in both frames. Layouts containing cells with a landscape aspect ratio less than Min land or a portrait aspect ratio greater than Max port are silently discarded. Use this to suppress unusable layouts that may result as the options are traversed.
Remember the Curse of Dimensionality. The number of layouts built expands exponentially with the options checked. It is all too easy to build a library with such a large number of similar layouts as to render it totally useless (and take a long time to build). Limit shape, alignments, etc. to one or two until you know what you are doing and have a compelling reason for doing it.
Note: There appears to be a bug in InDesign whereby the library window is sometimes not refreshed after the script completes. If the layouts do not appear in the library refresh the window by resizing it.
The following figures show a number of libraries built with with this tool.
Single-Pane, Dual-Pane, and Bleed with default options
Dual-Pane, Max rows, cols of 3
Single-Pane, Max 3x3, full, landscape, portrait, & square
Landscape shape, Max 1x1, reduced scale, near alignments
Square shape, Max 1x3, reduced scale, center alignment
Photobook_Reset.jsx
This script silently sets the dialog options for the layout and library script to default values. Only meaningful on CS3 and later since option values are not remembered on CS2.
Issues
I'm not happy with the appearance of the dialog boxes and hope to migrate to ScriptUI eventually.
Release Notes
Current Release - 1.0.9 - 14 Jan 2013
The new features added with the 1.0.8 release (generalized bleeds and two-column menus) were included only with scripts with _exp in the names: Photobook_Layout_exp.jsx and Photobook_Library_exp.jsx to give an opportunity for testing. With the 1.0.9 release these features are now in the scripts with the original names: Photobook_Layout.jsx and Photobook_Library.jsx and the scripts with the _exp have been removed.
The C-circle copyright symbol in the comments of the scripts (ASCII 0xA9) caused an error when the script was run by a user in China. The character was removed to avoid future problems.
All Releases
- 1.0.9 - 14 Jan 2013 - Make experimental (*_exp) scripts current. Remove circle-c copyright symbol. No functional changes.
- 1.0.8 - 17 Nov 2011 - Convert menus to two columns for better fit on short screens, add generalized bleeds. In experimental scripts.
- 1.0.7 - 4 Nov 2010 - test on CS5
- 1.0.6 - 10 Apr 2008 - clean up code
- 1.0.5 - 8 Apr 2008 - library work - add aspect limits, remove lib constraint table, generate in loop
- 1.0.4 - 4 Apr 2008 - add scale and alignment to multipane and library generation.
- 1.0.3 - 31 March 2008 - add scale and alignment
- 1.0.2 - 26 March 2008 - change caption height & gap to fixed
- 1.0.1 - 23 March 2008 - add caption frames, guides, open lib test, options persistence
- 1.0.0 - 20 March 2008 - Initial release
License
You may execute these scripts for any purpose - commercial or personal - free of charge. I have benefited greatly from free software. I offer this back to the community as a way of saying thanks.
You may not redistribute these scripts without permission, in writing, from me.
If you are a photo-book printer and would like to offer these scripts to your users, please contact me to discuss licensing.
Contact
Please let me know if you find any bugs or have suggestions for improvement. I would also appreciate a note if you found the scripts useful. (Address is in an image to reduce spam.)
More Samples
3x3 portrait aspect
3x1 horizontal split-pane, full area
1x1, 65% scale factor, near right, near bottom alignment
2x3 square
1x3 square, centered, 80% scale, fixed gap
Full bleed with 4x1 square overlay
1x2, full area
2x1 horizontal split-pane, full area, with captions
Composite of two bleeds. Align left, bleed top left bottom, scale 100% full;
3x1 align right bleed top right bottom scale 100%, shape full.
Align bottom right, bleed bottom right, 80% scale, shape landscape
Align right center, bleed right, 80% scale, shape full
1x4, align bottom, bleed left, bottom, right, 100% scale, shape square
Copyright 2010 - All rights reserved.
Page last revised 14 Jan 2014