jQuery Extract the main Colour of an Image’s borders : Image-pixel-border

jQuery Extract the main Colour of an Image's borders : Image-pixel-border

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:

  1. Clone the image in a dynamically created HTML canvas element.
  2. Read the pixels of the TOP, BOTTOM, LEFT, RIGHT borders of the image
  3. Extract the most frequent color
  4. Return the extracted color to your callback
Tags:

Leave a Reply