View Single Post
Old 01-13-2013, 02:46 PM   #5
ichrispa
Enthusiast
ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.ichrispa shines like a glazed doughnut.
 
Posts: 40
Karma: 8604
Join Date: Dec 2012
Location: Germany
Device: Kobo Touch
Quote:
I'm afraid this is beyond my tech skills, my Linux knowledge is zero, but if someone ever writes a step-by-step or packages it into something simple and foolproof I'd be interested.
Well, taking a screenshot does require you to at least get telnet access to your kobo at some point. Even if a php skript does the "screenshooting" for you, you would still need to get it installed somehow.

There are really plenty of guides on how to enable telnet access to the kobo, incl. the mobilereader wiki.

You can get the raw screen content by issueing the following command over a telnet prompt:

Code:
root@kobo# cat /dev/fb0 > /mnt/onboard/screenshot.raw
After that the file screenshot.raw should appear if you connect your kobo to a pc via usb.

The steps you need to take next are more or less the same whichever way you go:
  1. Convert the Raw data from RGB565 to RGB888 (8 Bit Raw image)
  2. Convert that 8 bit raw image using gimp/ImageMagick/Python

I use the following script on my kobo to do convert a RGB565 Image to PNG.

Code:
#!/bin/env python
#
# This script convert the ARM Linux RGB565 Framebuffer contents to a PNG Image
# You need PyPNG and Python >= 2.7 installed to run this script.
#
# Use on your own risk

import png
import struct

RAWD = "/dev/fb0"

rawf = open(RAWD, b"r")
pngf = open("/mnt/onboard/.local/out.png", "w")

rawpng_flat = []
rawpng = []
pixel = []

data = rawf.read(2)
while data != "":
  r5 = (struct.unpack("H", data)[0] >> 11)  & 0x1F
  g6 = (struct.unpack("H", data)[0] >> 5)   & 0x3F
  b5 = (struct.unpack("H", data)[0])        & 0x1F
  r8 = (r5<<3)+(r5>>2)
  g8 = (g6<<2)+(g6>>4)
  b8 = (b5<<3)+(b5>>2)
  
  rawpng_flat += [r8%256, g8%256, b8%256]
  data = rawf.read(2)

png.Writer(width=800,height=600,bitdepth=8).write_array(pngf, rawpng_flat)

pngf.close()
rawf.close()
I have both python and pyPNG installed on my Kobo, so all I need to do is call this script via php to create a screenshot.
ichrispa is offline   Reply With Quote