-2

This is my python code:

image = /folder/image.png
def download_image(path):
 # insert download image proccess here
download_image(/anotherfolder/imagecopy.png)

What I want to do, is to download the image from /folder to /anotherfolder as imagecopy.png
I don't have an URL to the image. I just want to copy it.

Any ideas on how I could do this?

Leo
  • 11
  • 5
  • [How to save an image locally using Python whose URL address I already know?](https://stackoverflow.com/questions/8286352/how-to-save-an-image-locally-using-python-whose-url-address-i-already-know) answers your question. – wwii Jun 21 '22 at 19:10
  • Start with a better example. `image = /folder/image.png` is not valid Python code. – Matthias Jun 21 '22 at 19:17
  • if you open a terminal in /images/ and run `python3 -m http.server 9000` then you can open a browser, type `localhost:9000` into the address bar and you should see alisting of the directory contents. From there you can right click on the file and 'save as' where you like and with what name you like. – Sean C Jun 21 '22 at 19:18
  • `/folder/image.png` is also not a valid URL. – martineau Jun 21 '22 at 19:50

1 Answers1

1

I don't want to copy it there, or place it there, I want to download it like it was a file from the internet.

Downloading is just copying the file from a server computer to your computer. It looks like you are trying to make a copy of an image on your computer to another place on your computer. "Downloading" is copying it.

Loydms
  • 156
  • 3
  • Sorry for the misinformation, I improved on the question – Leo Jun 21 '22 at 19:17
  • This thread should answer your question. But instead of using "image.png" use the path "folder/image.png". https://stackoverflow.com/questions/27515913/create-a-copy-of-an-image-python – Loydms Jun 21 '22 at 19:29