Create PDF photo albums that behave just like books on your Nook or Kindle ebook reader with a little help from ImageMagick and PDFtk Server.
The Nook Simple Touch claims that it supports graphic images (e.g. jpg, gif, png and bmp files). Yes, images contained in your ebooks appear just fine. But if you want to conveniently browse a collection of photos, then you’ll probably be disappointed.
The official method for viewing photos is to copy them into the Nook’s screensaver folder. The trouble with this is that these photos appear only when the Nook is asleep, and even then they are very cumbersome to navigate (you can step through screensaver photos by pressing the power button twice).
Our solution is to create a PDF photo album. As a PDF, the Nook will navigate your photos just as if they are pages in a book.
But we won’t stop there. We’ll add PDF bookmarks to make photos easy to navigate. We’ll add PDF metadata to make your album fit nicely in your Nook library. And we will optimize the images so that they look their best on the Nook while also saving disk space.
While these tricks were tested using a Nook, they will also work for Kindle and other ebook readers.
To begin, you will need to install ImageMagick.
For Windows, download and install ImageMagick-i686-pc-windows.exe. During installation, select the Add application directory to your system path option.
Most Mac users can install ImageMagick using a handy installer provided by Cactuslab at http://cactuslab.com/imagemagick/. After installing it on my Snow Leopard, I found ImageMagick’s convert program located at /usr/local/ImageMagick/bin/convert.
Linux users should be able to find and install ImageMagick using their package manager.
Create a folder named nook_work and copy some photographs into it. Create a folder inside this folder and name it nook_output. Open a command-prompt or terminal and then change into nook_work. For example:
Try this on Windows: select a folder or file in the file explorer and then drag-and-drop it into the command-prompt window. The full path name of that folder/file will appear at the cursor. This is a handy way to avoid typing in long folder/file names.
In this case, open the command-prompt, type cd<space>, then drag-and-drop your nook_work folder into the command-prompt.
Before creating a PDF album let’s look into optimizing images for the Nook. When we’re done we’ll have nice, lightweight images that we can put in the Nook’s screensaver folder.
My Nook Simple Touch has a 600x800 grayscale display, so it makes sense to load it with 600x800 grayscale images. Another thing to adjust for is the way the Nook rotates screensaver images so that they appear ‘right side up.’ The result is that a landscape-oriented photo doesn’t fit well on its portrait-oriented screen. ImageMagick can fix that, too.
We can do all this with one simple command. On Windows it looks like:
convert.exe Tulips.jpg -colorspace Gray -rotate "90>" -page "600x800" -resize "600x800" -gravity center -quality 85 nook_output\Tulips.jpg
What do all these options mean? ImageMagick is well documented at http://www.imagemagick.org/script/convert.php. If you aren’t using a Nook Simple Touch, adjust the options to fit the display size of your device (the 600x800 part). For color devices, drop the -colorspace Gray part. Photo frame users will probably want to drop the -rotate "90>" part. (Send me the options that worked for you and I will add them to this article.)
Now let’s process the entire folder. In Windows command-prompt, enter:
for %f in (*.jpg) do ( convert.exe "%f" -colorspace Gray -rotate "90>" -page "600x800" -resize "600x800" -gravity center -quality 85 "nook_output\%f" )
Using a Mac or Linux terminal, enter the following (note the backticks (`) around ls *.jpg — you’ll find that key in the top-left corner of your keyboard):
for ff in `ls *.jpg`; do convert "$ff" -colorspace Gray -rotate "90>" -page "600x800" -resize "600x800" -gravity center -quality 85 "nook_output/$ff"; done
Take a look at the resulting images in nook_output. They should be black-and-white photos that are oriented up-and-down. If they look good, you can copy them onto your Nook as we explain next.
Plug the Nook into your computer. Create a new folder for your photos in the Nook’s screensaver folder. Copy your photos into this new folder. Unmount and disconnect the Nook from your PC.
Press the Nook’s Quick Nav Button (n), select Settings, then Screen. Tapping Screensaver should give you a drop-down menu that includes your new folder. Select this folder. The next time your Nook goes to sleep, it will display one of your photos. Test it now by pressing the power button.
Okay, now let’s get back to creating a PDF photo album for your Nook.
Now that we know how to optimize photos for the Nook, creating a PDF album is easy. Just run the command:
convert.exe *.jpg -colorspace Gray -rotate "90>" -page "600x800" -resize "600x800" -gravity center -quality 85 nook_output\album.pdf
The resulting PDF has one page for each image. Images are ordered alphabetically according to their filenames.
Copy this photo album PDF into your Nook’s My Files\Documents folder, and you will be able to navigate it just like any other Nook book!
Note: The Nook might initially complain that it can’t read a new PDF, saying: "Sorry, cannot open this book." Just try again and it will work fine — the message won’t return.
Your PDF photo album probably has a lot of photos, so finding a specific photo involves wading through the whole document one page at a time. Let’s fix this by adding PDF bookmarks. Despite the name, these don’t behave like ebook bookmarks. Rather, they provide a Table of Contents for your PDF that makes it much easier to navigate, especially in an ebook reader.
First you will need to install PDFtk Server 1.45 or later. Installers for Windows and Mac can be found here. Linux users might find version 1.45 using their package managers. If not, try to compile the latest from source code.
Next you need to create a bookmark data file. Create one based on your photos’ filenames by running one of the following scripts in the nook_work folder.
On Windows, run this command to create a shell that performs delayed variable expansion:
Now run this loop to create the bookmark data file (mind that there is no space before the &):
del data.txt& set /a p=1& for %f in (*.jpg) do ( ( echo BookmarkBegin& echo BookmarkTitle: %f& echo BookmarkLevel: 1& echo BookmarkPageNumber: !p!)>> data.txt& set /a p=p+1 )
Finally, add these bookmarks to the album PDF by running:
"C:\Program Files (x86)\PDF Labs\PDFtk Server\bin\pdftk.exe" album.pdf update_info data.txt output album_bookmarked.pdf
On Mac or Linux, create the bookmark data by running (again, note the backticks around ls *.jpg and expr $page + 1):
rm data.txt; page=1; for ff in `ls *.jpg`; do echo "BookmarkBegin" >> data.txt; echo "BookmarkTitle: $ff" >> data.txt; echo "BookmarkLevel: 1" >> data.txt; echo "BookmarkPageNumber: $page" >> data.txt; page=`expr $page + 1`; done
Finally, add these bookmarks to the album PDF by running:
pdftk album.pdf update_info data.txt output album_bookmarked.pdf
Open the resulting album_bookmarked.pdf in your PDF viewer and test its bookmarks. How does it look? Edit data.txt to suit.
Before loading this PDF onto your Nook, let’s add some information that will make it easier to find in your Nook library. Open the data.txt file you created above in a plain text editor (e.g. Notepad on Windows) and add these lines:
InfoValue: My Great Vacation
InfoValue: Sid Steward
Edit to suit and save. Then re-run the pdftk command you used above.
Copy album_bookmarked.pdf into your Nook’s My Files\Documents folder, and it will appear in your library using the title and author you’ve given it. Open this document and view its table of contents (tap the content button in the Reading Tools), and you will see your PDF bookmarks. Tap an item in the table of contents and it will take you directly to that photo.
Article Author: Sid Steward
Our mission is to make PDF easier to use.
Please contact Sid Steward by email. Include PDF Labs in the subject to ensure prompt delivery:
"If you like pdftk, then you’ll appreciate the other 25 programs and scripts I created for my book, PDF Hacks." –Sid
For ten years, power users have relied on PDFtk for server-side processing of PDF documents. Our command-line PDFtk has been — and always will be — free (as in freedom) software.
Today we also offer a convenient graphical application: PDFtk Pro. Your purchase of PDFtk Pro will help fund the continued development of our GPL PDFtk.
Thank you for your support!
Copyright © 2004–2014 Steward and Lee, LLC