Skip to content

Instantly share code, notes, and snippets.

@Nub
Created November 15, 2011 02:34
Show Gist options
  • Select an option

  • Save Nub/1365955 to your computer and use it in GitHub Desktop.

Select an option

Save Nub/1365955 to your computer and use it in GitHub Desktop.
/*
* How to search for images and restrict them by color.
*/
google.load('search', '0');
function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
// Create an ImageSearch
var imageSearch = new google.search.ImageSearch();
//imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_COLORIZATION,
// google.search.ImageSearch.COLORIZATION_GRAYSCALE);
// Add the searcher to the SearchControl
searchControl.addSearcher(imageSearch);
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("content"));
// Find me something fit for a fairytale
searchControl.execute('KROQ logo');
}
google.setOnLoadCallback(OnLoad);​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment