Editing photos on the internet just got a heck of a lot easier! Now you can spruce up photos that reside on the net from within your web or desktop applications using our newly minted fototools service. Think we're overstating how easy it is? Check out the code snippets below.

Client Libraries: PHP 5  Python  Ruby 

PHP

Picks a random function from the list and performs it on a particularly disturbing picture of a muscular dog.
$imageLocation = "http://farm2.static.flickr.com/1341/727663041_63325260bf.jpg?v=0";
$arr_func = array("round", "rframe", "cube", "repaint", "grayscale", "focus", "sobel");
$func = $arr_func[array_rand($arr_func)];

$source = sprintf("http://www.fotocrib.com/fototools.php?q=%s&s=%s", $func, $imageLocation);
$img = imagecreatefromjpeg($source);
imagejpeg($img, "buff_dog.jpg");

Ruby

require 'net/http'

f = File::open( "buff_dog.jpg", "w" )
image_location = "http://farm2.static.flickr.com/1341/727663041_63325260bf.jpg?v=0"
action = "label"
args = "&t=big+dog&l=South&r=122&g=0&b=0"

Net::HTTP.start( 'www.fotocrib.com', 80 ) do |http|
    f << http.get( '/fototools.php?q=' + action + '&s=' + image_location + args ).body
end

f.close

Python

import random, urllib

imageLocation = "http://farm2.static.flickr.com/1341/727663041_63325260bf.jpg?v=0"
funcList = ["round", "emboss", "thumbnail", "paint", "grayscale", "focus", "sobel"]
func = funcList[random.randint(0, len(funcList) - 1)]

stream = urllib.urlopen("http://www.fotocrib.com/fototools.php?q=%s&s=%s" % (func, imageLocation))
pic = stream.read()
stream.close()

fd = open("buff_dog.jpg", "w")
fd.write(pic)
fd.close()

Java

import javax.imageio.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;

public class Main {

  public static void main(String[] args) {	 
    try {			
	    String imageLocation = "http://farm2.static.flickr.com/1341/727663041_63325260bf.jpg?v=0";
	    String[] action = {"rframe", "round", "focus", "mirror", "repaint", "frame"};
	    String func = action[((int)(Math.random() * action.length)) - 1];
		
	    URL source = new URL("http://www.fotocrib.com/fototools.php?q=" + func + "&s=" + imageLocation);
		
	    BufferedImage input = ImageIO.read(source);
	    File outputFile = new File("buff_dog.jpg");
	    ImageIO.write(input, "JPEG", outputFile);		
	} catch (Exception e) {
	    e.printStackTrace();
	}
  }
}

Javascript

Our favorite!. These four lines of code make up the core of fotowidget, one of our most popular web applications.
function doItToIt(func, imageId) {
	imgSrc = document.getElementById(imageId).src
	document.getElementById(imageId).src = "http://www.fotocrib.com/fototools.php?q=" + func + "&s=" + imgSrc  
}

Getting started is trivial. All you have to do is browse the list of available functions here. This list is by no means static, we continue to actively add more functionality from week to week. Our goal is to have all the features of our studio accessible by developers without the overhead of api keys and bloated SOAP requests. Cheers and happy coding!.