Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 02-15-2014, 12:16 PM   #1
AMB-ereader
Junior Member
AMB-ereader began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Feb 2014
Device: Kobo wifi
Kobo wifi PNG display

I have just got a Kobo wifi (4-bit display version), rooted it and installed the koboWeather[3] app on it.

Something that I haven't seen anywhere in my research is a better way of displaying images other than using the "/usr/local/Kobo/pickel showpic" method. Even the koboWeather app uses this which causes one fairly major drawback - speed. Converting the pygame surface to a raw image takes very many seconds.

By using the ioctl dumper interposer[2] I decoded the relevant ioctl for displaying an image. Then with the aid of one of the libpng example programs[3] I hacked together a program that can read a PNG image and write it to the display without using pickel.

With the aid of this program the koboWeather app's convert_to_raw function requires only a single line to write a PNG file

Code:
def convert_to_raw(surface):
    pygame.image.save(surface,"/tmp/img.png");
which can then be displayed with my new program

Code:
call(["rpng-kobo", "/tmp/img.png"])
which is much faster than converting to a raw image and displaying it.

My program can also display a PNG image which is not full-screen by passing in the x,y coordinates of the top left of the image like this:

Code:
rpng-kobo test.png 300 400
In theory this could be used to make apps more interactive since you don't need to refresh the whole screen for every update - something for further investigation.

I've attached the source code and executable - only tested on an eReader wifi with 4-bit display.

[1] https://bitbucket.org/david_weese/kobo-weather-app
[2] https://github.com/kobolabs/Kobo-Rea...e/master/poser
[3] http://www.libpng.org/pub/png/book/sources.html
Attached Files
File Type: zip png-kobo.zip (16.2 KB, 308 views)
AMB-ereader is offline   Reply With Quote
Old 02-16-2014, 10:06 AM   #2
AMB-ereader
Junior Member
AMB-ereader began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Feb 2014
Device: Kobo wifi
I discovered (after posting) that the code didn't work for all image sizes - specifically odd widths. There was some special case code for odd horizontal pixel positions but that only worked for full size images.

The new version fixes the bug and seems to work for all image sizes (odd and even widths) and positions (odd and even horizontal position). It has only been tested on a Wifi eReader with 4-bit display.
Attached Files
File Type: zip png-kobo.zip (16.2 KB, 281 views)
AMB-ereader is offline   Reply With Quote
Advert
Old 02-17-2014, 06:37 PM   #3
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
Nice work! I'll give it a try on my 8-bit Kobo Wifi when I get some time.
KevinShort is offline   Reply With Quote
Old 02-21-2014, 03:11 PM   #4
AMB-ereader
Junior Member
AMB-ereader began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Feb 2014
Device: Kobo wifi
Quote:
Originally Posted by KevinShort View Post
Nice work! I'll give it a try on my 8-bit Kobo Wifi when I get some time.
That would be good to know.

If you do try then this newer version might be better. There is still something funny that seems to happen after a suspend/wake cycle (failure to update but restarting nickel fixes it). I added two more ioctl() calls that the pickel program uses and it seemed to make it a bit better.

I have another program that completely blanks the screen but that doesn't help with the task in hand of partial updates. It looks like when a partial update is performed only the pixels that have changed are updated so perhaps it gets confused sometimes about what is already displayed.
Attached Files
File Type: zip png-kobo.zip (16.2 KB, 314 views)
AMB-ereader is offline   Reply With Quote
Old 03-28-2014, 10:03 PM   #5
Tandy
Junior Member
Tandy began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2014
Device: Kobo
This is excellent! I can confirm it works on my 8-bit version. I'm planning on writing something that looks like Kevin's app, but pulling data from my personal weather station. It will help to be able to render the individual metrics (temp, humidity, wind, etc) individually.
Tandy is offline   Reply With Quote
Advert
Old 04-01-2014, 02:04 PM   #6
AMB-ereader
Junior Member
AMB-ereader began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Feb 2014
Device: Kobo wifi
Quote:
Originally Posted by Tandy View Post
This is excellent! I can confirm it works on my 8-bit version. I'm planning on writing something that looks like Kevin's app, but pulling data from my personal weather station. It will help to be able to render the individual metrics (temp, humidity, wind, etc) individually.
That's great news.

Did you see my other thread https://www.mobileread.com/forums/sho...d.php?t=235006 where I provided an RSS reader application that made use of this and also included native Python code that could write to the screen directly? This would allow a partial screen update in real-time if you wanted that.
AMB-ereader is offline   Reply With Quote
Old 03-19-2016, 07:31 PM   #7
Kobold001
Junior Member
Kobold001 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Mar 2016
Location: Erlangen, Germany
Device: Kobo Glo
I want to test this program, too. The program returns the error /lib/libpng12.so.0: version 'PNG12_0' not found. It looks as I have a newer libpng12.so.0 on my Kobo Glo. Please help me to re-compile the rpng-kobo program.
Kobold001 is offline   Reply With Quote
Old 03-20-2016, 09:10 AM   #8
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
@Kobold001:

I didn't know about this program, my own alternative is here:

https://github.com/frostschutz/Kobo/...show/pngshow.c

You can find it as a binary in my screensaver/autoshelf and some other mods.

Unlike this one it does not support coordinate offsets (yet?) although you can achieve a similar effect using transparency...
frostschutz is offline   Reply With Quote
Old 03-21-2016, 04:38 PM   #9
Kobold001
Junior Member
Kobold001 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Mar 2016
Location: Erlangen, Germany
Device: Kobo Glo
Thanks frostschutz. I found out that those pngshow programs require a greyscale PNG file with 16 colors. Well, the input PNG files I have, have more colors.

I want to download PNG files from the internet with wget and then display them. This will not work with pngshow without an automatic conversion on the Kobo. I didn't find any converter. That's a pity.
Kobold001 is offline   Reply With Quote
Old 03-21-2016, 07:10 PM   #10
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,477
Karma: 26012492
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
ImageMagick to the rescue!

There's a binary in there, as well as my usual one-liner.
NiLuJe is offline   Reply With Quote
Old 03-21-2016, 07:56 PM   #11
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Quote:
Originally Posted by Kobold001 View Post
I want to download PNG files from the internet with wget and then display them.
Color depth should not be an issue (my pngshow should support all PNG, if you find one that does not work, send me a copy). The framebuffer of the Kobo is actually full color anyway (RGB565) so if you take a screenshot in the webbrowser you'll see colors too. The conversion to 16 levels grey is something that happens in the e-Ink driver - I guess.

However pngshow is really just a stupid program that draws PNG on screen, it does not do any scaling or whatever, so this should be the main problem when just downloading random images from somewhere.
frostschutz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Images display wrong on kindle 3 keyboard wifi ebina1 Kindle Developer's Corner 11 11-26-2013 03:32 PM
PNG Images in ePUB Files not rendered on Kobo DragonflyKing ePub 12 10-12-2013 08:28 PM
Any way to display custom graphics on the Kobo Wifi? KevinShort Kobo Developer's Corner 1 10-13-2012 03:57 PM
Odd; Kobo-purchased book reads fine on Desktop, WiFi and Sony -but not on Kobo Touch. beautifulsoup Kobo Reader 4 07-17-2012 09:29 AM
where to get autorun.xml, icon.png, key.png, lut.bin for PRS-505 obender Sony Reader Dev Corner 2 01-25-2009 03:20 PM


All times are GMT -4. The time now is 02:21 PM.


MobileRead.com is a privately owned, operated and funded community.