I have the following URL:
url = http://photographs.500px.com/kyle/09-09-201315-47-571378756077.jpg
I would like to extract the file name in this URL: 09-09-201315-47-571378756077.jpg
As soon as I get this file name, I am going to save it with this name on the desktop.
filename = **extracted file name from the url** download_photo = urllib.urlretrieve(url, "/home/ubuntu/Desktop/%s.jpg" % (filename))
After that, I'm going to resize the photo, as soon as this is done, I will save the modified version and add the word "_small" at the end of the file name.
downloadedphoto = Image.open("/home/ubuntu/Desktop/%s.jpg" % (filename)) resize_downloadedphoto = downloadedphoto.resize.((300, 300), Image.ANTIALIAS) resize_downloadedphoto.save("/home/ubuntu/Desktop/%s.jpg" % (filename + _small))
Based on this, I try to get two files: the original photo with the original name, and then the changed photo with the changed name. Like this:
09-09-201315-47-571378756077.jpg
09-09-201315-47-571378756077_small.jpg
How can I do it?
source share