Image Color Picker

Image Color Picker is an easy jQuery plugin which allows you to pick colors of an image, just like the color picker tool in Gimp, Adobe Photoshop or similar software.

Demo

Check out the demo.

Usage

Include required files

<script src="jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="jquery-ui-1.8.9.custom.min.js" type="text/javascript"></script>
<script src="jquery.ImageColorPicker.min.js"></script>
<link rel="stylesheet" href="ImageColorPicker.css" type="text/css" media="screen" charset="utf-8"/>

Use the plugin:

$("#myImg").ImageColorPicker();

The selected element must be an image tag. Multiple instances are possible.

Get the selected color:

$("#myImg").ImageColorPicker("selectedColor")

Output is the color code in hex with a leading hash, e.g.: #00ff00 for green.

Instead of manually getting the color you can use the “afterColorSelected” callback:

 $("#myImg").ImageColorPicker({
  afterColorSelected: function(event, color){ alert(color); }
});

Download

  • Image Color Picker Code on Github.com

Browser Compatibility

Image Color Picker currently works only in Firefox, Chrome and Safari. I’m working on supporting IE in one of the next versions. Turns out ExCanvas does not support all the Image function, including getImageData, which is quite essential for this project. So afaik there is currently no way to make this plugin work in IE.

Dependencies (included in download files)

License

Image Color Picker is released under MIT-License.

Files

  • dist/ImageColorPicker.css – some styles
  • dist/jQuery-1.4.4.min.js – minified version of jQuery 1.4.4
  • dist/jQuery-ui-1.8.9.custom.min.js – Core and Widget module of jQuery UI 1.8.9
  • dist/jquery.ImageColorPicker.js – development version of Image Color Picker plugin
  • dist/jquery.ImageColorPicker.min.js – minified version of Image Color Picker plugin (3.2kb)
DeliciousTwitterFacebookLinkedInRedditSlashdotTechnorati FavoritesDiggShare

One Response to Image Color Picker

  1. mohit jain says:


    THIS IS NOT WORKING IS IE6-IE8 WHY?

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">