Convert an image into a cartoon in Java

One of my most popular Facebook app is Cartoonize your profile pic in which Profile photo of the user is converted into a cartoon. For this I had used an external library Jhlabs which can be downloaded here

Here is the code which will convert the given buffered image into a sketch. For this I have downloaded shell script from here : Cartoonize script. This script basically interacts with ImageMagick to create effects. You can download ImageMagick from here : ImageMagick Download

As I was running this app in windows OS, I used cygwin software to run the shell script.

path1 is the path of the image we want to cartoonize and oath2 is the output location.

     String[] env = new String[] { "path=%PATH%;C:/Downloads/ImageMagick-7.0.2-Q16;c:/cygwin64/bin/" };
 
     Process p = Runtime.getRuntime().exec(
						"C:/cygwin64/bin/bash.exe c:/Downloads/bash/cartoon  "
								+ path1 + " " + path2, env);
 
     p.waitFor();
     p.destroy();

Uday Ogra

Connect with me at http://facebook.com/tendulkarogra and lets have some healthy discussion :)

You may also like...

Leave a Reply

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