
A very lightweight and simple jQuery plugin to extract the main color of an image’s border. Just pass a callback as first parameter of the getPixelColor which takes one parameter. The parameter send to your callback will be the hexadecimal color code.
In few words:
- Clone the image in a dynamically created HTML canvas element.
- Read the pixels of the TOP, BOTTOM, LEFT, RIGHT borders of the image
- Extract the most frequent color
- Return the extracted color to your callback