Get output image name with python

Can you explain, what do you want to achieve?