Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I download and save images from the web?

I'm trying to make a Windows Phone 7 app that will save some images off the web, I have no idea where I can or if I can save images from the web to the phone.

What can I do to save images?

like image 766
Landmine Avatar asked Nov 10 '10 07:11

Landmine


People also ask

How do I save an image from a website?

Right click that URL and click Open in new tab. 6. In the new tab, right click the image and choose Save image as. Now you can name your file and save it to your computer.


1 Answers

You can download them using WebClient or WebRequest to get the raw bytes.

You can then save to isolated storage fairly easily - but I don't believe you can save in any location seen by the Picture hub, if that's what you were aiming for. (I can't see anything in the Microsoft.Phone.Tasks namespace which would be relevant. There are tasks to capture the camera of choose a photo, but not to save one.)

EDIT: Ooh, I've just found a way. You can use the MediaLibrary class and its SavePicture method... although that's in XNA, so I'd at least have concerns about it working from a Silverlight app. I know some bits of the XNA API do work from Silverlight, and some don't. Worth experimenting with.

like image 160
Jon Skeet Avatar answered Oct 26 '22 06:10

Jon Skeet