Image Kindleizer

Officially speaking, you can’t view an image on a Kindle without enclosing it in a Mobipocket ebook. But there is an undocumented workaround. Sheet music is usually in static formats like GIF or PDF, so the workaround makes it easier to use legacy sheet music on a Kindle.

So here is a script to automatically handle the labor.

#!/bin/sh

#
# Given an image in the console, copy it to a mounted Kindle in such a
# way that the Kindle will include it in listings.
#
# Depends on Image Magick


IMG=$1
TITLE=$2
MOUNTPOINT=$3
if [ "$IMG" == "" -o "$TITLE" == "" -o "$MOUNTPOINT" == "" ]
then
    echo 'usage: kindleizeimage [image file] [title] [Kindle mount point]'
    exit
fi
if [ ! -f "$IMG" ]
then
    echo "$IMG :("
    exit 1
fi
if [ ! -d "$MOUNTPOINT" ]
then
    echo "$MOUNTPOINT :("
    exit 1
fi

tgtD="$MOUNTPOINT/pictures/$TITLE"
if [ ! -d "$tgtD" ]
then
    mkdir -pv "$tgtD" || exit $!
fi

tgtF="$tgtD/"`basename "$IMG"`

convert -rotate "-90>" "$IMG" "$tgtF" || exit $!

echo "Kindle -> Alt + z"

Leave a Reply

Your email address will not be published. Required fields are marked *