Paul Irofti

About me: 
 Resume (RO)

 System Administration
 Security Audits

 [E-mail address]

Viewing images on the Kindle

This article will show how to display image files on the Kindle without
having to go through Amazon's conversion service, but by merely transferring
files on Kindle's internal storage.

It used to be that you could just transfer a directory filled with JPEGs or
PNGs and it would get picked up and displayed as new once you disconnect
and power-up the device.
I have an old 2011 directory on my Kindle that holds as evidence that in
the past you were able to do that and my hack is largely based on it.

There are two methods that I know of through which you can still display
picture files from a directory on the Kindle:
 ZIP and Transfer
 Transfer and Create Special Files

The special files solution is a hack I found by looking at the files
created by Kindle in my old 2011 directory.
By mimicking their structure I was able to once again enable directories
for viewing. I also wrote a script that does all the work for you.

ZIP and Transfer

Put the image files in a ZIP archive and transfer it somewhere inside
the documents directory found on Kindle's internal storage.
A new item by the name of the archive should pop-up once you disconnect
and power-on the device.

Transfer and Create Special Files

Transfer a directory with the images somewhere inside the documents
directory found on Kindle's internal storage.
Run this script to create internal state and pass the collection it
belongs to as its argument like so:

$ ./ collection

So if you had the picture directory sketches filled with PNGs,
and Kindle's storage mounted on /kindle and you want to add
sketches to the work collection, the following sequence
would add it to your Kindle:

$ cp -r sketches /kindle/documents
$ cd /kindle/documents/sketches
$ ./ work

Afterwards, unmounting /kindle and powering on the device should
display sketches as the most recent item.

That's it!

For the curious, I will next describe what the script does.

The Script

There are two files that Kindle creates inside an image directory:
a bookmark file and a magic file.

The bookmark filename has the following format:


So for the sketch example it would look like:


The bookmark's first line is a comment containing the accessed date.

#Wed Apr 02 01:59:36 EEST 2014

The script builds this string by using the date(1) command.

DATE=`date +"%a %b %d %T %Z %Y"`
echo "#${DATE}" > "${ITEM}.${COLL}_save"

ITEM is built by looking at the basename(1) of the
pwd(1) output and COLL is received as an argument to
the script:

ITEM=`basename "${PWD}"`

The second line is the actual bookmark pointing to the last read item.


The important part is the one starting after documents.
I've seen LAST written both as a full path and as a relative path.

The script builds a path similar to the one I found on my old 2011 entry
just to make sure it works.
So all the paths will start with /mnt/us/documents followed by the
actual directory path within documents.

DIR=`pwd | sed s,[\]\[_a-zA-Z/\-]*/documents,/mnt/us/documents,`

Next, the script picks the first picture listed by ls(1) as its
bookmark and builds the LAST path with it:

FILE=`ls | head -1`
echo "LAST=${LAST}" >> "${ITEM}.${COLL}_save"

That takes care of the bookmark file.

The magic file is easier to build.
The filename scheme is similar to that of the bookmark:


So for the sketch example it looks like:

Notice the missing _save suffix.

The magic cookie is a null byte. So it's enough to do:

echo -en "\x00" > "${ITEM}.${COLL}"

That's it. With this any directory containing images on your Kindle should
be available for viewing. Enjoy!


All my experiments were made on a Kindle 3. Let me know if the same trick
works on other models.