Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sodhanalibrary/background-color-thief

Detect Background Color Of An Image Using Javascript
https://github.com/sodhanalibrary/background-color-thief

Last synced: 4 days ago
JSON representation

Detect Background Color Of An Image Using Javascript

Awesome Lists containing this project

README

        

# Background-Color-Thief
This script is to detect background color of an image. Thanks for Color-Theif (https://github.com/lokesh/color-thief/) for such a great work.
Here I have used some code from Color-Theif.

##How To Use

####HTML markup
```js


```

####Javascript
```js
var backgroundColorThief = new BackgroundColorTheif();
var rgb = backgroundColorThief.getBackGroundColor(document.getElementById("backgroundImage"));
document.getElementById("backGroundColor").style.backgroundColor = 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] +')';
```
##Demo

[Click here] (http://demo.ftmocks.com/get-background-color.html) to seee demo

##Algoirithm behind this script

Most dominant color of edges and corners of image can be background color of the image. [Click here] (http://blog.ftmocks.com/2015/05/detect-background-color-of-image-using.html#.VUNPFSGqqko) for more explanation

##Applications

I have implemented some online tools using this script. Take a look at below links

[Facebook Optimized Images](http://flaticon.ftmocks.com/generate-facebook-optimized-images.html)

[Facebook App Icons and Banners](http://flaticon.ftmocks.com/generate-facebook-icons-and-banners.html)

[Phonegap Icons and Screens](http://flaticon.ftmocks.com/generate-phonegap-icons-screens.html)