Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Python PIL image.save() performance hit

General discussion about anything TouchDesigner

Python PIL image.save() performance hit

Postby tohox » Thu Jul 04, 2019 8:52 am

Hi,

I'm using the Python PIL (Pillow) module's PIL.Image.save() method every few seconds through a timer CHOP's callback and every time this particular method gets called I see TD's framerate drop with a noticeable stutter in the playback of all other parts of the project. The file I'm saving to disk is a 400x3000 PNG with alpha that weighs < 200kB. This is running on a pretty speedy 4GHz quad Xeon with SSDs, ample RAM, Quadro graphics cards etc.

I'm sure I'll find another way around this probably by avoiding saving to disk and keeping everything in memory instead but this got me wondering about how tasks running on the CPU (such as execs) are threaded within TD and how they might affect other tasks running on the GPU and ultimately affect playback.

  • Any general thoughts or traps to avoid when making heavier use of Python within TD?
  • Is there a "better" way of passing images being generated or modified through Python back into TD tops besides files?

Thanks!
tohox
 
Posts: 58
Joined: Tue Jun 14, 2016 1:29 pm

Re: Python PIL image.save() performance hit

Postby alphamoonbase » Fri Jul 05, 2019 8:02 am

If you are not refferencing any TD stuff, you can try to thread the whole saving project not impacting the main thread.
The bump in FPS is, as TD waits for the process of saving the file to complete before proceeding with the rest.
Maybe you can try using a the moviefileoutTOP instead.
alphamoonbase
 
Posts: 33
Joined: Fri Jun 26, 2015 3:54 pm


Return to General TouchDesigner Discussion

Who is online

Users browsing this forum: James3D and 14 guests