Save view slices to .PNG or .jpeg

Hi community!

I now need to save all of the slices from the Red node view.
I can only do it by copy image manually.
I’m wondering if I can do it in the python interactor to save all slices in a command?

Thank you.