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

Embed Images in Email Campaigns at Scale

By Sourav Kundu
Embed Images in Email Campaigns at Scale

We live in an era of information overload and attention is the real currency. Marketers are constantly looking for new ways to reach you, to advertise products and services that they think could improve your lives.

Read more
Build the Back-End For Your Own Instagram-style App with Cloudinary

Github Repo

Managing media files (processing, storage and manipulation) is one of the biggest challenges we encounter as practical developers. These challenges include:

A great service called Cloudinary can help us overcome many of these challenges. Together with Cloudinary, let's work on solutions to these challenges and hopefully have a simpler mental model towards media management.

Read more

Build A Miniflix in 10 Minutes

By Prosper Otemuyiwa
Build A Miniflix in 10 Minutes

Developers are constantly faced with challenges of building complex products every single day. And there are constraints on the time needed to build out the features of these products.

Engineering and Product managers want to beat deadlines for projects daily. CEOs want to roll out new products as fast as possible. Entrepreneurs need their MVPs like yesterday. With this in mind, what should developers do?

Read more

Your Web Image is Unnecessarily Bloated

By Christian Nwamba
Your Web Image is Unnecessarily Bloated

As a developer, it seems inefficient to serve a 2000kb JPEG image when we could compress images to optimize the performance without degrading the visual quality.

We are not new to this kind of responsibility. But our productivity will end up being questioned if we do not deliver fast. In order to do so, the community has devised several patterns to help improve productivity. Let's review few of these patterns based on their categories:

Read more

Google For Nigeria: We saw it all…

By Christian Nwamba
Google For Nigeria: We saw it all…

Note from Cloudinary: Christian Nwamba, a frequent Cloudinary contributor, recently attended, and was a main speaker, at the Google Developer Group (GDG) Conference in Lagos, Nigeria. Christian led a session teaching more than 500 developers how to “Build Offline Apps for the Next Billion Users.” The stack he used included JS (Vue), Firebase, Service Workers and Cloudinary. Below is his account of the conference and his talk.

Read more
Viral Images: Securing Images and Video uploads to your systems

When was the last time you got paid $40,000 for a few days of work? That is what happened last year to Russian independent security researcher Andrey Leonov, who discovered that if you upload a specially constructed image file to Facebook, you can make Facebook's internal servers, nested deep within their firewalls, run arbitrary commands to expose sensitive internal files in a way that could easily lead to a data breach.

Read more