Click here to Skip to main content
13,089,400 members (60,132 online)
Click here to Skip to main content
Add your own
alternative version


18 bookmarked
Posted 30 Jan 2010

A small application for downloading website images automatically

, 30 Jan 2010
Rate this:
Please Sign up or sign in to vote.
If you see a website with a lot of nice images which you want to store on your computer, this application will help.



There is this Boston Global website called 'Big Picture' ( and I love it. It shows pictures from people, animals, buildings, events, and all kinds of other stuff that is happening around the world. The quality of the images is excellent and I use them as desktop backgrounds a lot.

I found myself 'Saving as ...' a lot of images, and needed something to do this for me. The .NET framework makes it so easy to do something like this, that I wrote an application in a matter of minutes to download the images automatically.

Note: I use the pictures as background images. Please respect the photographer's rights - and don't use this app for anything illegal.


To make an application like this is really easy. What you need to do is:

  1. Get the website contents (HTML) of a specified page
  2. Get the image URLs from the HTML
  3. Download all the images

So ..

  1. What I did was add a WebBrowser component to my windows form, starting up in Google. Now the user can navigate to whatever page he/she likes. To get the source of the current document, I use the WebBrowser.Document property.
  2. Then, we extract the IMG tags form the HTML using this method:
  3. public static List<string> GetImagesFromWebBrowserDocument(HtmlDocument document)
        var result = new List<string>();
        // Get the <img> tags from the html
        foreach (HtmlElement item in document.Body.GetElementsByTagName("img"))
            // Add the src attribute to the list - which contains the image url
        return result;
  4. Finally, to download the images, I use the WebClient class:
  5. public static void DownloadFile(string url,string destinationFolder)
        if (!destinationFolder.EndsWith("\\"))
            destinationFolder = string.Concat(destinationFolder, "\\");
        using (var web = new WebClient())
            var source = url;
            var segments = source.Split('/');
            // Get the filename of the image - and add
            // it after the destination folder address
            var destination = destinationFolder + 
                               segments[segments.Length - 1];
                // Download the file
                web.DownloadFile(source, destination);
                  "Download OK - {0} ==> {1}", source, destination));
                  "Download FAILED - {0} ==> {1}", source, destination));

I added the possibility to select the download folder and added some events for updates, but that's all there is to it.

Stuff I might want to do in the future

What I could do is add a threshold for the minimum size of the image, so that logo's etc., aren't downloaded every time. Also, I don't have any checks on filenames (duplicates), but hey, it's working fine like this.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Other Student Computer Sciences
Netherlands Netherlands
Computer Sciences student.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
Jmcortes13-Aug-11 6:42
memberJmcortes13-Aug-11 6:42 
GeneralNice...but Pin
thund3rstruck1-Feb-10 6:21
memberthund3rstruck1-Feb-10 6:21 
GeneralPerhaps ... Pin
Richard MacCutchan30-Jan-10 1:32
mvpRichard MacCutchan30-Jan-10 1:32 
GeneralRe: Perhaps ... Pin
Trollslayer30-Jan-10 2:05
mentorTrollslayer30-Jan-10 2:05 
GeneralRe: Perhaps ... Pin
AYK_16130-Jan-10 2:12
memberAYK_16130-Jan-10 2:12 
GeneralRe: Perhaps ... Pin
Richard MacCutchan30-Jan-10 2:41
mvpRichard MacCutchan30-Jan-10 2:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170813.1 | Last Updated 30 Jan 2010
Article Copyright 2010 by AYK_161
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid