Cloudinary Blog

Cloud-based API for applying effects on images

If you Google for “Hello Cloudinary”, you will find some intriguing articles claiming that Cloudinary is a Photoshop replacement. Well, although the comparison is very flattering and we do believe that Cloudinary is a fantastic service for web developers, we never thought of our service as a replacement for Photoshop. However, some image manipulation features of Cloudinary allow web developers and web designers to dynamically modify the look & feel of their website’s images in an extremely easy way without manually processing their images using an image editing desktop software. In this blog post we wanted to describe some of Cloudinary’s newest features - applying effects and filters on images.

Effects 

Applying effects on images is done using the new ‘effect’ parameter or ‘e’ for URLs. Some effects also accept an additional numeric parameter. Here are some examples:

Let’s take the following ‘horses’ image that was uploaded to Cloudinary:

http://res.cloudinary.com/demo/image/upload/horses.jpg

The following examples modify the color saturation of the image. A negative saturation value will reduce saturation and a positive will increase it:

.../image/upload/e_saturation:-70/horses.jpg       .../image/upload/e_saturation:70/horses.jpg

   

If you’re using Cloudinary’s client-side integration libraries, applying this transformation is made even simpler:

Ruby on Rails:

<%= cl_image_tag("horses.jpg", :effect => "saturation:70") %>

PHP:

<?php echo cl_image_tag("horses.jpg", array("effect" => "saturation:70")) ?>
Django:
{% cloudinary "horses.jpg" effect="saturation:70" %}

 

With Cloudinary’s cloud-based transformations you can also change an image’s brightness

.../image/upload/e_brightness:-50/horses.jpg      .../image/upload/e_brightness:50/horses.jpg

   

 
You can also apply a sepia effect. Use either the default sepia level or set a custom level by specifying the extra numeric value:
 
 
And you can also easily convert an image to grayscale or apply an oil-paint effect:
 

 

Chained Transformations

If you read our documentation and follow our blog posts, you probably know that Cloudinary already provides many image transformations and delivery methods. By chaining these image transformations together, you can create images that perfectly complement your graphic design.

For example, the following image is Arianna Huffington’s Facebok profile picture:

Take a look at the following Cloudinary URL that generates the image below:

.../image/facebook/w_150,h_150,c_thumb,g_face,r_20,e_sepia/l_techcrunch,g_south_west,x_5,y_5,w_50/a_10/AriannaHuffington.png 

 

What happened here? Simply accessing the above URL told Cloudinary to remotely fetch Arriana Huffington’s Facebook profile picture, created a 150x150px thumbnail using face detection based cropping, rounded the image’s corners, added a sepia effect, converted it to a transparent PNG format, added a watermark layer on the bottom-left corner, rotated the image by 10 degrees clock-wise and ultimately delivered the resulting image through a fast CDN using smart caching techniques. Isn’t that great?

Same example in Ruby on Rails:

<%= facebook_profile_image_tag("AriannaHuffington.png", :angle => 10, 
        :transformation => 
          [{:width => 150, :height => 150, :crop => :thumb, 
            :gravity => :face, :radius => 20, :effect => :sepia},
           {:overlay => "techcrunch", :gravity => :south_west, 
            :x => 5, :y => 5, :width => 50}]) %>

 

Tweaking a Website’s Color Scheme

Web developers and web designers often encounter a scenario in which a client sees their website and asks for just a tiny tweak to the color scheme they used. Changing colors of texts and other HTML elements can be easily done using CSS tweaks. But what about the images that construct your website’s design? With Cloudinary you no longer need to process all images to generate slightly different color variations. You can simply apply the hue change effect on all images delivered by Cloudinary. It accepts a numeric value between -100 and 100.

For example, the following is a background image used on Cloudinary’s web site.



<img src="site_bg.jpg" width="350" height="135" data-src="site_bg.jpg" 
     class="bg_image"/>

The following URL can be used to generate a version with a slightly different hue:



The same can be achieved using Cloudinary’s client-side libraries. For example, this is how it might look like using our jQuery library:
$('.bg_image').cloudinary({ effect: "hue:50"});

All effects and filters described above are available for all our paid and free plans. Want to try it out? Sign up to our free plan in seconds.
Please tell us what you think about the new effects. Should we support additional effects? Any other image transformation features still missing?

Recent Blog Posts

Responsive Images Guide, Part 1: What does it mean for an image to be “responsive”?

“Responsive.” Where did that term come from, anyways?

In his sea-changing essay, Responsive Web Design, Ethan Marcotte explained:

Recently, an emergent discipline called “responsive architecture” has begun asking how physical spaces can respond to the presence of people passing through them. Through a combination of embedded robotics and tensile materials, architects are experimenting with art installations and wall structures that bend, flex, and expand as crowds approach them. … rather than creating immutable, unchanging spaces … inhabitant and structure can—and should—mutually influence each other.

Read more
Automatically deliver the best image format to the browser

One of the main optimization challenges for website and mobile developers is how to display sufficiently high quality images to their visitors while minimizing the image file size. A smaller image file size can lead to faster load times, reduced bandwidth costs and an improved user experience. The problem is that reducing the file size too much may lead to a lower image quality and could harm visitor satisfaction. Delivering an optimized image with just the right balance between size and quality can be quite tricky.

Read more