— Dane Creek

Creating Blurb PDFs Using Lightroom and InDesign

Last year I put together a Blurb book of photos from my trip to Antarctica. I knew going into the book that I wanted complete control over every aspect of the book layout which meant using a proper page layout package. In my case I went with Adobe InDesign CS4, since that’s what I had available.

I also knew from past experience that I would be spending a lot of time messing around with the selection and sequencing of photos for the book. I wanted an easy way to quickly change the image content of the book without having to manually redo the pages every time. If I did a draft of the book, decided to swap out four photos and add 6 more, I didn’t want to spend an hour in InDesign making the modifications manually adding images and text to frames.

Thankfully InDesign supports data merging, and if you pair that with Adobe Lightroom and an inexpensive plug-in you can automate the entire process of generating your book’s image plates.

In this blog entry I’ll walk through the steps necessary to make this all work.

The overall approach

My overall approach was to do all the image selection, ordering, and metadata wrangling in Lightroom. I let InDesign handle the page layout of the plate pages only. Any text that I wanted printed on the page along with the image had to be metadata associated with the image in Lightroom, not manually entered in InDesign text boxes.

Step 1: Get the plug-in

Lightroom doesn’t, unfortunately, have native support for exporting image metadata as a separate file. Since InDesign’s data merge functionality requires a text file with the data, I needed a way to extract the metadata.

The tool for this job is the LR/Transporter Plug-in from Photographer’s Toolbox. Unless you are including fewer than 10 images in your book you’ll need to donate some money to unlock the full version. The donation is well worth it for the amount of time you will save.

Step 2: Select and prepare your images

Create a collection in Lightroom that contains all the images you want to include in your book. Make sure the images also have the text pieces you want to include on your plate pages as metadata. In my case that was simply ensuring each image had the Title filled in. Finally, re-order the images in the collection to match how you want them to appear in your book (I didn’t know you could do this in Lightroom until this book project! Just drag the images around in Library grid view.)

My book images, in order, in a Lightroom collection.
My book images, in order, in a Lightroom collection. 

Step 3: Export your photos

Using the standard Lightroom Export command, export your photos to a directory somewhere. For now you can just do a straight export at whatever resolution you like, but later on when you do your final version of your book you’ll want to export to a resolution that exactly matches the pixel resolution of your page’s image frame in InDesign.

Step 4: Export your metadata

Using the LR/Transporter plug-in from the File > Plug-in Extras menu in Lightroom export the metadata for your book images. Use the Summary file tab to create a comma-separated text file that has all the necessary metadata for your book in it. In my case I needed to know the filename for the exported image and the image title.

LR/Transporter Export Settings (click image for a larger view)
LR/Transporter Export Settings (click image for a larger view)

The head of the summary file will tell InDesign what pieces of data to expect for each image. In my case it looked like this:

@FileName,Title{return}

This will tell InDesign to expect two pieces of data for each image: the filename for the image and its title. The @ in front of FileName is very important. It tells InDesign that the text is really a filename for an image.

The text to add for each photo looks something like this:

{fileNameNoExtension}.jpg,{title}{return}

This will result in one line per image that contains the filename with .jpg added to it (since I exported as JPEG), and the title of the image from metadata.

Then select the output directory so it’s the same as the folder you saved your images to in step 3, and click ok. This will give you a file called summary.txt with all the relevant image information to automatically generate your book.

If you want to include additional metadata for use in the book that’s fine. Just make sure there’s a header for it, and separate each piece of metadata from the next with a comma.

Step 5: Create your InDesign template

Using InDesign create a template your book’s image plates. Put frames on the page wherever you would like a piece of content, such as the image, title, EXIF data, etc. Format the frames with whatever formatting you would like the text to have.

Step 6: Map the Metadata in InDesign

With your template from step 5 open, go to the Window > Automation > Data Merge menu. This will bring up the Data Merge panel. From the panel menu select Select Data Source…. In the file dialog that appears navigate to the folder where your images are and select the summary.txt file generated in step 4. 

The Data Merge panel. It doesn't look like much, but it is the key to making all this work.</
The Data Merge panel. It doesn’t look like much, but it is the key to making all this work.

If your metadata export worked correctly you should see a list of metadata items in the Data Merge panel. The image filename should have an image icon in the left column, not a text icon. All the rest should have text icons.

The Data Merge panel after pointing it at the metadata file.
The Data Merge panel after pointing it at the metadata file.

At this point you can drag and drop the pieces of information onto the appropriate frames in your template. You’re essentially telling InDesign where to stick each piece of information on the page when you do your merge.

Once you’re done mapping the metadata save this template as an InDesign file called “Merge Template” or something similar. This won’t be your actual book file, it’s just the template you’ll use later on.

The completed InDesign template with the merged fields mapped. Click image for a larger view.
The completed InDesign template with the merged fields mapped. Click image for a larger view.

Step 7: Do the Merge

At this point you’re ready to automatically produce your book. From the Data Merge panel menu select Create Merged Document. Merge all records as Single Record. On the Options tab make sure you select Fit Images Proportionally and Center In Frame for best results. Then click Ok to create your book.

If all goes well a new document will be created in InDesign with one page for each of your images, and the metadata will magically appear where you wanted it. Neat, eh?

One minor gotcha at this point: InDesign doesn’t create a merged document with 2-page spreads. This isn’t really what you want if you’re doing a book. To fix it, after the merge is done, drag page 2 in front of page 1 in the Pages panel (this converts everything to 2-page spreads). Then drag the new page 1 in between pages 2 and 3. This will re-order the pages so they match your order from Lightroom.

Save this InDesign file as your actual book, and voila! You’re done!

Additional Tips

At this point you have all the components to quickly make new variations of your book as you edit your photos. Let’s say you decide you don’t like four of the photos you included, and you want to replace them with four new ones. Also, you found 6 great photos you’d overlooked before that have to be included too. No problem! Add them to the collection in Lightroom, order them appropriately in Lightroom, and export your metadata and images again (step 3 and 4). Then open your template from step 6 and select Update Data Source from the Data Merge panel menu. This tells InDesign about your new metadata, and then you can do the merge as in step 7 to get a whole new book with the new images.

While this merge concept is great for the image plates of your book, how do you handle all the other pieces of a book, like title pages, introductions, acknowledgments, etc.? InDesign’s Book feature is perfect for that. What I did for my Antarctica book is create the following separate InDesign files:

  • Front Matter
  • Plates (the auto-generated piece)
  • Back Matter

The Front Matter and Back Matter files were hand authored with all the bits that didn’t change regularly, and the Book feature of InDesign helped me keep the page numbers in sequence across all three. When the time came to upload to Blurb I just exported the whole thing as a PDF from the Book panel menu.

If you have any questions about the above feel free to post them below and I’ll do my best to answer.