| Reply | « Previous Thread | Next Thread » |
|
pyS60 version: 1.1.6 (FAST sis)
using graphics module for screenshot I´m writing an app that takes screenshots of current display and save the imagens as a jpg in a given directory. I´ve tried 3 aproaches: 1) Append each screenshot to a list and save everything in the end 2) Save each screenshot as soon as it is captured 3) Spawn a new thread to save the new screenshot solution 1 works fairly well, but only for a few seconds (depends on the desired FPS) before it fills up the phone memory, leading to a system crash solution 2 works but is VERY slow (< 1FPS) because writing the jpg is slow. solution 3 crashes every time. Wasn´t able to discover why because I´m using the emulator and it aborts. I may be able to get more information using the bt_console, but I´m still waiting for my bluetooth dongle to arrive ![]() Anyway, has anybody run into a problem using threads to perform any tasks? Is there another way to acomplish this? Thanks in advance! |
|
Quote:
Quote:
Quote:
|
|
Quote:
Code:
def saveimage(img, frame, basedir, basename):
name = '%s\\%s%.5d.jpg' % (basedir, basename, frame))
img.save(name, quality=40)
while not stop:
img = graphics.screenshot()
thread.start_new_thread(saveimage, (frame, basedir, basename))
![]() Quote:
Quote:
![]() Thanks! Igor |
|
Actually, the Ao_lock code is a very crucial part of the code, so posting that would be useful.
|
|
Quote:
Code:
import thread
def import_modules():
import bt_console
import time
thread.start_new_thread(import_modules, ())
...
As for the the Ao_lock code, I will post it as soon as get home (I'm currently at work). Just for the record, I'm using Python 1.1.6 pre-alpha and the Python SDK 2ed. Thanks. |
|
Quote:
|
|
I verified that there is a bug in the graphics module w.r.t thread support: at least Image.new fails when done in a non-UI thread. We'll look into it.
|
|
Quote:
I'm looking forward to it. |
|
Hi,
I also would like to write a script that could capture the screenshots for every few milli seconds. I tried the first two options. But its still slow. Is it possible to capture more frames per second(more than five) if threads are used. I have tried using the threads. But I could not get it working. Can anyone give me some hints on writing this script by using threads. br, Bhavani |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |