WebImageExtractor 1.0.1

There is a newer version of this package available.
See the version list below for details.
Install-Package WebImageExtractor -Version 1.0.1
dotnet add package WebImageExtractor --version 1.0.1
<PackageReference Include="WebImageExtractor" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebImageExtractor --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WebImageExtractor, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install WebImageExtractor as a Cake Addin
#addin nuget:?package=WebImageExtractor&version=1.0.1

// Install WebImageExtractor as a Cake Tool
#tool nuget:?package=WebImageExtractor&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Web Image Extractor

.NET library to extract images and icons from websites. Provides options to select Favicons, Apple Touch Icons, or all images on a page.

Blazor Demo

Available on NuGet

Install using the NuGet Package Manager:

Install-Package WebImageExtractor -Version 1.0.0

Features (all are optional and can be speicified in ExtractionSettings):

  • Extracts Favicons and Apple touch icons.
  • Extracts images from <img> tags.
  • Extracts images from <link> and <meta> tags within HTML head.
  • Extracts images from background images in CSS background-image: uri('https://...'). Currently this only works for inline styles and not referenced .css files.
  • Supports Uri Recursion. E.g. Extracting from https://example.com/dir/page.html also extracts from https://example.com/dir and https://example.com.
  • Supports following Hyperlinks (specified in <a> tags) up to a certain depth and extracting images from those pages too.
  • Supports triggering events when new images are found or new pages are explored.
  • Supports ending the extraction algorithm when a condition is met (e.g. enough images found).
  • Supports Blazor (including Client Side Blazor / Blazor WebAssembly).
  • Includes example console application.

To see an online example use of this tool, checkout this Blazor demo. You can find the source code for the demo here.

Note: If you are after something specific, e.g. a way of getting 48px square .ico icons from websites ... please note that some websites might only have one icon available and others might not have any. This library isn't magic, so you might not get exactly what you want. It's always best to give a user choice over the best icon/image, or even let them provide their own, don't rely entirely on the algorithms.

How does it work?

Favicons are found from the standard places. First the path /favicon.ico is checked, and then it checks for <link> tags in the HTML head. Any link with a valid Favicon rel property will be returned as a Favicon.

It works in a similar way for Apple Touch Icons.

When looking for all images on a page, Favicons and Apple touch icons are retrieved, then all other images in <link> and <meta> tags are retrieved, followed by all images in <img> tags, and finally all images specified using background-image: url('https://...') within inline styles (if enabled in settings). Note that images are not pulled from background-image styles set in separate .css files. It only works for inline styles.

Recursion works by exploring Uris with segments removed, and by following hyperlinks (<a> tags) on the page, providing these are enabled in the settings.


See the GitHub Readme for a complete and updated quick-start.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 236 8/28/2020
1.0.1 139 8/27/2020
1.0.0 131 8/27/2020