How to Transform an Image into an Artistic Painting with Java

There are four distinct formats available in our Artistic Painting API — those include “udnie”, “wave”, “la_muse,” and “rain_princess”. Why not give them all a try? To take advantage of this API, check out instructions included below to copy code snippets provided in Java.

Start by installing the Java SDK with Maven. First things first, add a reference to the pom.xml repository:


Next up, add a reference to the dependency in pom.xml:


Conclude by adding the import classes and calling the function:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.ArtisticApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
ArtisticApi apiInstance = new ArtisticApi();
String style = "style_example"; // String | The style of the painting to apply. To start, try \"udnie\" a painting style. Possible values are: \"udnie\", \"wave\", \"la_muse\", \"rain_princess\".
File imageFile = new File("/path/to/inputfile"); // File | Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.
try {
byte[] result = apiInstance.artisticPainting(style, imageFile);
} catch (ApiException e) {
System.err.println("Exception when calling ArtisticApi#artisticPainting");

You’ll need to define the string style where indicated in the documentation, and supply your Cloudmersive API key (can be obtained by creating a free account on our website Home — Cloudmersive APIs).



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.