One more thing I've noticed about running viewportGrab is that the amount of memory max uses increases each time you use the script. After several grabs things can start to get a little slow so I suggest running a garbage collect every once in a while. Perhaos this could be added to the script?