Distorted .PPM Snapshots

I"m trying to save snapshots of a simulation for video purposes, but I am having difficulty even with the built in .PPM files. I’m using the function:

I am trying to save the images using the python interface to build a videoanimation from the screen captures, but the saved PPM looked distorted compared to the display in NGsolve. Any advice would be greatly appreciated.

Screenshots now showing. Now uploaded them here: