Hello Guest
No Avatar
Web Design  »  
Resources  »  
Sign In to Remove
Posts: 
400
Reputation: 
20
Posted: January 23, 2013, 4:51 AM  -- Last Edit: May 19, 2013, 11:06 AM by MLM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
Here is a easy to use Kmean API for favicon's of websites. This API will analyze the 16x16 favicon of the requested url and return the most prevalent color in the image.


You can read more about Kmean clustering and check out the app here.

Use:
To use the API just call the link with parameters:
Code: [Select]
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php
Parameters:
url: Define the url you wish to analyze
Code: [Select]
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php?url=http://visualpulse.net/

k (optional): number of color clusters.
Default: 3
Code: [Select]
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php?url=http://visualpulse.net/&k=3

ignoreExtremity (optional): Enable/Disable the ignoring of color extremities (white and black)
Default: true
Code: [Select]
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php?url=http://visualpulse.net/&k=3&ignoreExtremity=true
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php?url=http://visualpulse.net/&k=3&ignoreExtremity=false

blackLevel, whiteLevel(optional): Level at which you cut off the extremities of black and white. This is the symmetric rgb equivalent (ex. rgb(10, 10, 10))
Defaults: blackLevel=10, whiteLevel=245
Max: 255
Min: 0
Code: [Select]
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php?url=http://visualpulse.net/&k=3&blackLevel=10&whiteLevel=245

Output
The API returns a JSON format of the data. Here is an example of the output:

Call:
Code: [Select]
http://apps.visualpulse.net/kmean_chrome_color_stripe/api.php?url=http://visualpulse.net/&k=3

Output:
Code: [Select]
{
"rgb": {
"r": 97,
"g": 107,
"b": 169
},
"hex": "616ba9",
"url": "visualpulse.net",
"k": 3,
"ignoreExtremity": true,
"blackLevel": 10,
"whiteLevel": 245
}
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
400
Reputation: 
20
Posted: May 19, 2013, 11:09 AM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
Fixed some major bugs with the whole algorithm working and added a couple features

Feature Additions:
ignoreExtremity: Able to ignore the extreme white and black values that muddy up the dominant color
blackLevel, whiteLevel: define these thresholds
<3 Nerve, Sk8, Labradoodle, Austin
anything