Get a Free Trial

Webpage to Icon API - Favicon Extractor with GrabzIt

With the Webpage to Icon API you specify the URL of a webpage to convert into an icon. One of he main benefits to using an icon conversion API is that it saves time and resources. Instead of making an icon yourself, you can use an API to create one quickly and easily.

This is especially useful for businesses or brands that have multiple websites or webpages that need icons. Using an API to generate icons ensures that your icon looks consistent and professional.

The Webpage to Icon API converts a URL to an icon. 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 favicons or meta icons are available it will generate one for the webpage. The chosen icon, the background and any border selected can change depending on the users selections.

To use the API replace the APPLICATION KEY text below with your application key. Then set the size parameter, which defaults to 32.

Finally specify the webpage that you want to turn into an convert. By passing the required URL to the URL parameter. In the following example, we convert https://www.astropioneer.blog/ into a 48x48 pixel image.

//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.

You should place the url parameter at the end of the querystring. This helps in avoiding the need to encode most URLs when using the API.

While you can download the image using a server-side language like PHP. You can also display it directly on a web page or use it in JavaScript as shown below. Remember that when using the API in a webpage. You must add the domain of the webpage 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>

You can also transform an image by selecting the desired transform from the options below. For instance, you can see an example here where the transform makes the resulting image 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 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 image This parameter is required to create an image image
size The size of the resulting square image So 32 would result in a 32x32px image
transform The transform to apply to the resulting image.
The default is none.
blackandwhite - create a black and white image
grayscale - create a grayscale image
inverse - invert the colors of the image
sepia - create a sepia colored image
source Define the preferred source of icons used in
generating the finished image.
The default is all.
all - use all types of icon
favicon - only use favicons
metadata - only use the webpage metadata icons

Errors

The API can return the following error codes.

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