Ever wonder what colors to use with an image?
Use our API to do it in your app!
API Overview
The Pictaculous API is quite a simple one that simply allows you to make a HTTP POST request to our webservice and have the generated color palettes returned as a serialized JSON encoded object.
API Endpoint: http://pictaculous.com/api/1.0/
Currently there is only one function for this API, so nothing is required except the one parameter.
Parameter: image
The image parameter should be the binary file data for the image you would like analyzed - PNG, GIF, JPG only. Files cannot be larger than 500k.
Returned data:
- info - basic info about the image submitted
- colors - an array containing the 6 suggested color codes (hex) to use with the image
- url - a url to the image we received and stored
- kuler_themes - an array containing palette information from Adobe Kuler based on the suggested color palette. Each entry contains:
- id - the Kuler theme id
- title - the theme title
- colors - an array containing the 6 color codes (hex) in the theme
- author - the theme's author
- rating - the theme's rating
- url - the url for the theme
- thumb - the url to a thumbnail image for the theme
- cl_themes - an array containing palette information from Colour Lovers based on the suggested color palette. Each entry contains:
- id - the Colour Lovers theme id
- title - the theme title
- description - a description of the theme
- colors - an array containing the 6 color codes (hex) in the theme
- author - the theme's author
- userName - the theme's author's username
- dateCreated - the date the theme was created (YYYY-mm-dd HH:ii:ss)
- rating - the theme's rating
- rank - the theme's overall rank
- numVotes - the number of votes the theme's received
- numViews - the number of views the theme's received
- numHearts - the number of users who have "hearted" the theme
- numComments - the number of comments the theme's received
- url - the url for the theme
- imageUrl - the url for an image representing the theme
- badge - the url for a badge image representing the theme
- badgeUrl - the url for a badge image representing the theme
- apiUrl - the API url for the theme
- thumb - the url to a thumbnail image for the theme
Example PHP Code for calling the API:
<?php
$ch = curl_init();
$url = 'http://pictaculous.com/api/1.0/';
$fields = array('image'=>file_get_contents
('picttest.jpg'));
# Set some default CURL options
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_URL, $url);
$json = curl_exec($ch);