Tools to Capture and Convert the Web

Webpage to Icon API - Favicon Extractor with GrabzIt

The Webpage to Icon API converts URL's into icons, just try this demo to see it in action. The Webpage to Icon API is not simply a favicon grabber, but instead bases the final icon on all the available icons for the webpage. If no icons are available it will generate one for the webpage. The source icon chosen, the background and any border selected can change depending on the users requirements.

To get started with the API replace the APPLICATION KEY text example in the below call with your application key then set the size parameter, which defaults to 32. Finally specify the webpage that you want to turn into an icon, by passing the required URL to the URL parameter. In the following example https://www.astropioneer.blog/ is being converted into a 48x48 pixel icon.

//api.grabz.it/services/icon?key=Sign in to view your Application Key&size=48&url=https://www.astropioneer.blog/
A URL parameter containing & or ? characters must be URL encoded.

It is a good idea to keep the url parameter as the last parameter in the querystring as this avoids having to URL encode most URLs passed to the Webpage to Icon API.

While the Icon can be downloaded this with a server side language such as PHP. It can also be displayed directly in a web page or used in JavaScript as shown below. Remember that when using the Icon API in a webpage the domain of the webpage must be added to the list of authorized domains.

<img src="//api.grabz.it/services/icon?key=Sign in to view your Application Key&size=48&url=https://www.astropioneer.blog/"/>
<script>
fetch('https://api.grabz.it/services/icon?key=Sign in to view your Application Key&size=48&url=https://www.astropioneer.blog/')
.then(response => response.blob())
.then(blob => {
    console.log(blob);
});
</script>

An icon can also be transformed just pass the transform you want to apply from the options below. An example of which can be seen here were the transform makes the resulting icon sepia.

//api.grabz.it/services/icon?key=Sign in to view your Application Key&transform=sepia&size=48&url=https://www.astropioneer.blog/

Parameters

The Webpage to Icon API accepts the following four parameters.

Name Description Options
key Your Application Key This parameter is required to create an image icon
url The url of the webpage to convert into a icon This parameter is required to create an image icon
size The size of the resulting square icon So 32 would result in a 32x32px icon
transform The transform to apply to the resulting icon.
The default is none.
blackandwhite - create a black and white icon
grayscale - create a grayscale icon
inverse - invert the colors of the icon
sepia - create a sepia colored icon
source Define the preferred source of icons used in
generating the finished icon.
The default is all.
all - use all types of icon
favicon - only use favicons
metadata - only use the webpage metadata icons

Errors

The Webpage to Icon API can return the following error codes.

Code Description
100 No URL Specified
103 Missing Application Key
104 Unrecognized Application Key
114 Icon Size Invalid
401 The domain this API is being used on must be authorized.
500 A upgrade is required