View Single Post
Old 02-28-2009, 12:25 PM   #1
kylecronan
-
kylecronan began at the beginning.
 
Posts: 15
Karma: 12
Join Date: Feb 2009
Location: Chicago, IL
Device: Kindle 2
Converting PDFs to images (Linux only)

I haven't tried PDFRead yet (just found out about that), but perhaps this is a useful alternative. Would be great to hear from somebody about how this compares to reading a PRC file created by PDFRead in landscape mode. In portrait the text is just too small on the Kindle.

Here is my original post from the Amazon forum:


So, thanks to igorsk, we know that the Kindle will display a folder of images in the same way as an ebook. Here's a procedure for converting even book-length PDF files to a folder of png images that are formatted for the Kindle.

This method uses a tool (xcf2png) that I couldn't get to compile in Windows, so you will need to have Linux installed to do this. Please don't reply asking for a Windows equivalent; unfortunately I won't be able to help you with that. MacOS could possibly work.

First we convert the PDF to an XCF file with a layer for each page (this part requires a lot of RAM):

1. Open the pdf file in GIMP
2. Click Select All
3. Open Pages as: Layers
4. Width: 800 pixels
5. Image | Mode | Grayscale
6. Save the file with a .xcf extension

Now we need to download and compile xcftools. You will need to have the libpng development package for your distribution installed. On Ubuntu, you would do: sudo apt-get install gcc make libpng12-dev

1. wget http://henning.makholm.net/xcftools/...s-1.0.4.tar.gz
2. tar zxvf xcftools-1.0.4.tar.gz
3. cd xcftools-1.0.4
4. ./configure --prefix=/usr
5. make && sudo make install

(Or, on Debian/Ubuntu, just do: sudo apt-get install xcftools)

Now we can convert the XCF to PNGs:

f=Your\ Filename\ Here.xcf ; i=1 ; d=`echo $f | sed 's/\.xcf//'` ; mkdir "$d" ; for n in `xcfinfo "$f" | sed '1d;s/.* //'` ; do j=`printf %03d $i` ; xcf2png -g -o "$d/${d}_${j}.png" "$f" "$n" ; i=$(($i+1)) ; done

This will make a directory with the same name as the XCF file and put the images in there. If you haven't already, create a directory called 'pictures' in the root of your Kindle's storage. Copy the directory with all the PNGs that you just made into 'pictures'.

Now you can press Alt-z from "Home" and this directory should show up as a book. Go to it and then bring up the menu. I'm using the following settings: rotate to landscape, dithering disabled, actual size enabled, fit to width and fit to height both disabled, pan to next page enabled. I would like to enable full screen also, but it appears to be incompatible with panning.

I found the landscape mode to be necessary in order for the print to be large enough to read comfortably (Jeff Bezos, don't worry: with a bit of practice you can still read with one hand!). If you don't like reading this way, just use a width of 600 instead of 800 when you open the PDF in gimp.
kylecronan is offline   Reply With Quote