Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rscott
Visitor

dfDrawImage taking a long time

Hi,

I'm new to Roku developing, so please bear with me if I'm missing something obvious.

I have written a script that repeatedly downloads a PNG image and displays it.

The script works, it is just slow. When narrowing down where the delays were, I saw that it was taking about 200-300ms to complete the dwDrawImage(screen,"tmp:/myphoto.png",0,0) command.

I've tried using screen.DrawObject() and screen.DrawScaledObject(), but both take a similar amount of time.

The only thing that comes to mind is the I/O of loading the file (it's around 600K). I tried switching to a compressed JPEG (40K), but the timing was similar (that sped up the download speed a bit, but not the drawing time).

Does anyone have any thoughts?

Here is the relevant code:


http = CreateObject("roUrlTransfer")		' Moved here from while loop to potentially save resources
http.SetUrl("http://192.168.1.5/img.jpg")
dt.Mark()
print dt.GetHours().tostr() + ":" + dt.GetMinutes().tostr() + ":" + dt.GetSeconds().tostr() + "." + dt.GetMilliseconds().tostr() + " PRE DOWNLOAD"
http.GetToFile("tmp:/myphoto.jpg")

dt.Mark()
print dt.GetHours().tostr() + ":" + dt.GetMinutes().tostr() + ":" + dt.GetSeconds().tostr() + "." + dt.GetMilliseconds().tostr() + " POST DOWNLOAD"
dfDrawImage(screen, "tmp:/myphoto.jpg",0,0)
dt.Mark()
print dt.GetHours().tostr() + ":" + dt.GetMinutes().tostr() + ":" + dt.GetSeconds().tostr() + "." + dt.GetMilliseconds().tostr() + " DONE DRAW"
0 Kudos
1 REPLY 1
RokuRobB
Streaming Star

Re: dfDrawImage taking a long time

I wonder if the server you are hitting cached the original request so that the 600kb image was always being saved and rendered? Perhaps try forcing a new download (using a new file name or adding a bogus query parameter to the query) and deleting the temp file before storing it for rendering by DrawObject.
0 Kudos