ดาวน์โหลดฟรี

ดาวน์โหลด Images Color Thief with jQuery
เข้าชมทั้งหมด : 594 ครั้ง | ดาวน์โหลด : 169 ครั้ง | หมวด : Image Effects


Images Color Thief with jQuery

Ever wanted to grab the dominant color or color palette from an image?… Probably not. But now you can!

Usecase #1: Color Search

This script could be useful for sites that sort and search by color. But you should probably save your user’s computer some work and handle the color processing on the server. A couple of color search site examples:


Usecase #2: Color Adapting UI

With this script you can build a UI that adapts to the colors of an image. For example, you could add color accents to the UI by changing the font or border color depending on what image is currently being displayed in your portfolio. To get a bit fancier you could darken the dominant color and use it as a background color or invert the dominant color and use it as the text color. Fancy indeed!

Usage

Grab the code from Github. Include jquery, quantize.js, and color-thief.js on your page. Then add something similar to the following:

1 myImage = $('#myImage');
2 dominantColor = getDominantColor(myImage);
3 paletteArray = createPalette(myImage, 10); // 2nd argument sets the # of colors in palette