View Single Post
Old 10-29-2012, 02:24 PM   #21
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
I've updated the first post with a link to the new weather app, and it should work on both
4-bit and 8-bit displays.

For anyone who's interested, here's the technical explanation.
Spoiler:
I looked at the raw image files on the Kobo in /etc/images, and I noticed that it seemed
to be formatted quite simply. It's just a list of hexadecimal colors, one for each pixel,
starting with the top left corner. For example, "\xff" is white, and "\x00" is black.

Here's some python code that takes an image loaded as a pygame surface and converts
it to a raw image format suitable for the Wifi.
Code:
def to_hex(color):
    hex_chars = "0123456789ABCDEF"
    return hex_chars[color / 16] + hex_chars[color % 16]
     
raw_img = ""
for row in range(surface.get_height()):
    for col in range(surface.get_width()):
        color = surface.get_at((col, row))[0]
        raw_img += ('\\x' + to_hex(color)).decode('string_escape')
f = open("/tmp/img.raw", "wb")
f.write(raw_img)
f.close()
The raw image file can be displayed with
Code:
cat img.raw | /usr/local/Kobo/pickel showpic

Last edited by KevinShort; 11-03-2012 at 11:49 AM.
KevinShort is offline   Reply With Quote