Search code examples
pythonpngopenstreetmap

Cannot choose the name for a png image in OSM (python)


I am trying to save a path built with OSM as a png image but I don't know how to put the name given by this function (which is the filename):

def plot_directions(graph, source_location, destination_location, directions, filename, width=400, height=400):
    ...
    image.save("filename.png")

The filename is something like filename = "city" I know that this approach is not correct for my purpose. How can I do it? Thanks


Solution

  • If the method parameter 'fileName' is the name of the file, such as fileName = "image.png", You can simply call this:

     image.save(filename)