Is That Some Type Of New Kindle?

[Mr C Camacho] picked up an inexpensive digital picture frame hoping to hack into it. He hasn’t had the time to crack open the hardware so that it will do his bidding but he did find a creative way to make it an ebook reader. Using a python script he processes books, creating images of the pages.

The python script, available after the break, takes free books from Project Gutenburg and spits out JPG images. Page turning and bookmarking are not what they ought to be but the process does work. The thought of someone staring at a picture frame on the subway is a bit amusing but we’re sure that sooner or later someone will ask if it’s a new version of the Kindle.

Usage explanation from the developer:

./process.py book.txt 480 234 16 /usr/share/fonts/truetype/ttf-droid/DroidSansMono.ttf 10 7

param

1   book.txt       the file name
2   480              native X resolution of picture frame
3   234              native Y resolution of picture frame
4   16                Number of vertical lines of text required
5   blah.ttf        full path and name of a ttf font
6   10                font size to use for lines
7   7                  font size for “page no x” at bottom of page

you’ll have to play with it to get it to work right for your size of screen

(its just a hack ;) )
The main thing to get right first is the font size of the width of the screen
from there you can work out the number of lines you can fit…

#!/usr/bin/python

import pygameimport sys

# ./process.py book.txt 480 234 16 /usr/share/fonts/truetype/ttf-droid/DroidSansMono.ttf 10 7

txtname=sys.argv[1]nativeX=int(sys.argv[2])nativeY=int(sys.argv[3])pagelines=int(sys.argv[4])fontname=sys.argv[5]fontsize=int(sys.argv[6])pagenosize=int(sys.argv[7])

f=open(txtname)

def cleanline(l): l=l.strip('\r') l=l.strip('\n') return l

pygame.init()screen = pygame.display.set_mode((nativeX, nativeY))lines=f.readlines()font = pygame.font.Font(fontname, fontsize)pfont = pygame.font.Font(fontname, pagenosize)

for ln in range(len(lines)/pagelines+1): background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((255, 255, 255))

 for pl in range(16): if (ln*16+pl)<len(lines): line=cleanline(lines[ln*pagelines+pl]) text = font.render(line, 1, (0, 0, 0)) textpos = text.get_rect(x=4,y=pl*(nativeY/pagelines)) background.blit(text, textpos) text=pfont.render("Page "+str(ln+1),1,(0,0,0)) textpos=text.get_rect(x=8,y=nativeY-pagenosize) background.blit(text,textpos) screen.blit(background, (0, 0)) pygame.display.flip() fn="page%#05d" % (ln+1) pygame.image.save(background,fn+".jpg")

42 thoughts on “Is That Some Type Of New Kindle?

  1. EFH,

    I’m not sure why there’s so much hate for the JPEG format. Yes, it’s lossy, but the degree to which it’s lossy is actually selectable. You can dial up the quality of a JPEG so much that you’d swear it was lossless at first glance.

    Also, the font can be scaled. It doesn’t have to be set at a size proportional to an ordinary monitor.

    Finally, presbyopia is not caused by trying to see tiny things. It is caused by age (it literally translates to “old eye” from Greek and Latin roots). The worst that will probably happen to you is eyestrain and the usual symptoms that come along with it (headache, etc.)

    It’s a hack. If the guy had busted the thing completely to do his dirty work maybe it would be capable of displaying crisp fonts with that snazzy subpixel rendering we’re used to with the wave of a magic firmware rewrite. He shouldn’t have to apologize for hacking a picture frame into an imperfect ebook reader.

  2. Nice idea. I’m wayyyyy to cheap to buy a kindle.

    I still prefer paper. I have an old laser printer (Samsung ML1200) and print out all my readings for college. Much Cheaper. 3000 pages from a 10 dollar refill. Who said everyone at UC Berkeley is Green. lol.

  3. I have been using a method like this for my Zune HD for awhile now. I did not use the Python script (I used a program called JpegBook, designed for the PSP but allows custom resolutions). I may give this method a shot though.

  4. I reckon he could do sub-pixel aliasing with a little mod to that script: render the lines three times the size, scale 33% vertically then filter horizontally, taking the R, G and B elements from each group of three to make each new pixel. I believe ImageMagik has a filter for doing exactly that.

    Might make it a bit easier on the eye if low resolution is a problem, and takes advantage of the fact it’s actually a color screen.

  5. I wrote this idea down in a notepad less than two weeks ago.

    My first thoughts after seeing this was that the bastard stole my idea (Id told someone on IRC)

    My idea was for snapshotting websites (primarily Hackaday) rather than ebooks, for my morning dose of epic hackness.

  6. I’m not so much hating on JPEG as hating on reading on low-res LCD (or *any* LCD) and calling it a Kindle substitute. Folks who haven’t seen e-paper are still not getting it, really. The difference in eyestrain level is really incredible. No disrespect for the hack — I did the same kind of thing for my original Palm Pilot a whole lot of years ago — but it ain’t no Kindle.

  7. This is hardly a new concept, like already mentioned, this is pretty common on handheld game devices like the DS and PSP, and has gone far back to devices as old as the Palm Pilot.

    Of course, there is a bigger problem with this hack than issues of compression, which seems to have been ignored in the original post. Battery powered digital picture frames with screens that large are fairly rare, and if the power cord peeking out of the right corner there is any indication, we won’t be seeing this little guy on the subway anytime soon.

  8. he didn’t even write the script? putting a picture of words on a picture frame and calling it a kindle isnt a hack, if he wrote the script then i would agree that there was a hack involved here, but what is going on here is like me buying a picture frame, downloading some porn, downloading a video to gif convertor, converting some frames, loading them on the picture frame, then claiming it as a hack because i made a digital picture frame, which was intended to display family photos, instead display internet porn. all with other peoples code, and no real hacking. but i didnt actually read the story and i understand how difficult it must be to find 3 legitimate hacks per day

  9. I was so taken with this attempt to beat Amazon, Sony and all of the other eReader makers at their own game, that I posted a short review of his work on my blog.
    I have been dipping into this site here on and off for quite a while, as to be honest, I love people who spend their time trying to make things do something they were never intended to do.
    Personally I havent tried to make any of the superb and silly things I have found here, but just get a tremendous buzz out of what the rest of you produce, and the underlying drive that makes you all do this. Good on ya guys! Keep it up!

    Tony

    eBookAnoid – Reviewing eReaders, eBooks, eBook Websites ….
    http://www.ebookanoid.com/
    ————————————————————

  10. I was wondering myself whether a digital photo frame might make a cheap eBook Reader for developing countries. Some have built-in batteries. I found a free MS Windows program called Bullzip that installs as a printer drive and prints to a set of auto-numbered JPEG pages. It could be good for prototyping photo-frame text display projects. Alternatively, PrimoPDF etc can print to PDF, then use IrfanView (Options, Extract All Frames) to convert PDF to numbered JPEGs.

  11. I’m looking for a similar frame to do a similar project…something that is relatively thin and takes batteries. I’m planning on stripping the board and screen out and making my own enclosure. Any ideas for a picture frame? The only good ones I found are quite bulky at the back. I’m looking for something like 7-10″.

  12. I’m surprised that virtually all of the picture frame “hacks” seem to use this trick of just feeding it the right pictures to make it do some other task like being a clock.

    No one seems to have gotten into the firmware of one of these things. Given that picture frames are getting relatively cheap and are starting to interesting features like wifi and touch screen I’d expect to find some interesting firmware replacements. Where is the Rockbox of the picture frames?

    Is it because there is no one platform that is common enough to justify the work or because the processors/chips are non-standard or because the design of these things tends to be so one off and closed that there isn’t an easy opening to flash in a replacement firmware?

    Not that I’m saying reversing a device firmware is easy or anything. It just seems like picture frames are such a great target that some hacker gods would have taken it on by now.

  13. @Agent420

    Surely you mean “especially on a desktop”. If you’re trying to read on a desktop no wonder you hate ebooks.

    It’s much better on a reader or, before these dark ages of alleged smartphones with half-size screens and expensive binding data plan contracts, a cheap “PDA”.

  14. @ Hildegarde,
    Who were you addressing that question to?
    If it was me, you can best go to my blog and put it in a comment box, then I can contact you and try and answer your question.
    If it was to the guys who run this site (which isnt a WordPress Site), then address it to them in the contact us section……
    Cheers, Tony

Leave a Reply to ChrisCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.