How to save the image on the same location automatically from where it was opened

It may possibly be achieved by using getEntryWithUrl to generate an Entry from a path string.

This example gives a good explanation.