Saving images
-
Friday, April 03, 2009 3:10 PMIs there a way to save an image to a file on the hard drive? You can get a picture "object" by pic = Flickr.GetRandomPicture("lightning" ), but there doesn't seem to be a way to save it. I have tried the File.WriteContents("c:\whatever\file.jpg",pic) approach, but this doesnt seem to work...
Thanks for any help,
Frank
All Replies
-
Friday, April 03, 2009 3:46 PMModeratorCheck out Network.DownloadFile
-
Friday, April 03, 2009 4:50 PMThanks, Vijaye.
Looks like it works great for known urls.
Are there any examples?
Thanks,
-
Friday, April 03, 2009 5:29 PMModerator
Here's an example of downloading a Flickr image to the local machine, and print out the file path.
pic = Flickr.GetRandomPicture("whale")
localFile = Network.DownloadFile(pic)
TextWindow.WriteLine("Local path: " + localFile)
You can then use File.CopyFile to copy the downloaded file to wherever you want.
pic = Flickr.GetRandomPicture("whale")
localFile = Network.DownloadFile(pic)
TextWindow.WriteLine("Local path: " + localFile)
File.CopyFile(localFile, "c:\pic.jpg")- Marked As Answer by Vijaye RajiModerator Wednesday, April 15, 2009 2:13 AM

