Need help with cloudinary_java?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

139 Stars 101 Forks MIT License 623 Commits 15 Opened issues


Cloudinary Java Client Library

Services available


Need anything else?

Contributors list

Build Status Maven Central license


Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more.

Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.

Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.

For Java, Cloudinary provides a library for simplifying the integration even further.


  • There are three flavors of the library to support different HttpClient versions: cloudinary-http42, cloudinary-http43 and cloudinary-http44.
  • For Android there's a separate library available at

Getting started guide

Take a look at our Getting started guide for Java.


The cloudinary_java library is available in Maven Central. To use it, add the following dependency to your pom.xml :


Alternatively, download cloudinary_java from here and here and see build.gradle for library dependencies.

Try it right away

Sign up for a free account so you can try out image transformations and seamless image delivery through CDN.

Note: Replace

in all the following examples with your Cloudinary's
cloud name

Accessing an uploaded image with the

public ID through a CDN:


Generating a 150x100 version of the

image and downloading it through a CDN:,h_100,c_fill/sample.jpg

Sample 150x100

Converting to a 150x100 PNG with rounded corners of 20 pixels:,h_100,c_fill,r_20/sample.png

Sample 150x150 Rounded PNG

For plenty more transformation options, see our image transformations documentation.

Generating a 120x90 thumbnail based on automatic face detection of the Facebook profile picture of Bill Clinton:,g_face,h_90,w_120/billclinton.jpg

Facebook 90x120

For more details, see our documentation for embedding Facebook and Twitter profile pictures.



Each request for building a URL of a remote cloud resource must have the

parameter set. Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the
parameters set. See API, URLs and access identifiers for more details.

Setting the

parameters can be done either directly in each call to a Cloudinary method, by when initializing the Cloudinary object, or by using the CLOUDINARY_URL environment variable / system property.

The entry point of the library is the Cloudinary object.

Cloudinary cloudinary = new Cloudinary();

Here's an example of setting the configuration parameters programatically:

Map config = new HashMap();
config.put("cloud_name", "n07t21i7");
config.put("api_key", "123456789012345");
config.put("api_secret", "abcdeghijklmnopqrstuvwxyz12");
Cloudinary cloudinary = new Cloudinary(config);

Another example of setting the configuration parameters by providing the CLOUDINARY_URL value to the constructor:

Cloudinary cloudinary = new Cloudinary("cloudinary://123456789012345:[email protected]");

Embedding and transforming images

Any image uploaded to Cloudinary can be transformed and embedded using powerful view helper methods:

The following example generates the url for accessing an uploaded

image while transforming it to fill a 100x150 rectangle:
cloudinary.url().transformation(new Transformation().width(100).height(150).crop("fill")).generate("sample.jpg");

Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:

cloudinary.url().transformation(new Transformation().width(90).height(90).crop("thumb").gravity("face")).generate("woman.jpg");

You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.

Embedding a Facebook profile to match your graphic design is very simple:

cloudinary.url().type("facebook").transformation(new Transformation().width(130).height(130).crop("fill").gravity("north_west")).generate("billclinton.jpg");

Same goes for Twitter:


See our documentation for more information about displaying and transforming images in Java.


Assuming you have your Cloudinary configuration parameters defined (

), uploading to Cloudinary is very simple.

The following example uploads a local JPG to the cloud:

cloudinary.uploader().upload("my_picture.jpg", ObjectUtils.emptyMap());

The uploaded image is assigned a randomly generated public ID. The image is immediately available for download through a CDN:


You can also specify your own public ID:

cloudinary.uploader().upload("", ObjectUtils.asMap("public_id", "sample_remote"));


See our documentation for plenty more options of uploading to the cloud from your Java code.


Returns an html image tag pointing to Cloudinary.


cloudinary.url().format("png").transformation(new Transformation().width(100).height(100).crop("fill")).imageTag("sample");


Returns an html input field for direct image upload, to be used in conjunction with cloudinary_js package. It integrates jQuery-File-Upload widget and provides all the necessary parameters for a direct upload.


Map options = ObjectUtils.asMap("resource_type", "auto");
Map htmlOptions = ObjectUtils.asMap("alt", "sample");
String html = cloudinary.uploader().imageUploadTag("image_id", options, htmlOptions);

See our documentation for plenty more options of uploading directly from the browser.

Additional resources

Additional resources are available at:


You can open an issue through GitHub.

Contact us

Stay tuned for updates, tips and tutorials: Blog, Twitter, Facebook.

Join the Community

Impact the product, hear updates, test drive new features and more! Join here.


Released under the MIT license.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.