Cloudinary Blog

Cloud-based API for applying effects on images

By Nadav Soferman
Create Image Effects and Filters by Using Cloud-Based API

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 transformation 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.

page load speed 

Image Effects 

Applying image effects 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:

https://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:

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

PHP:

Copy to clipboard
<?php echo cl_image_tag("horses.jpg", array("effect" => "saturation:70")) ?>
Django:
Copy to clipboard
{% 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:

Copy to clipboard
<%= 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.



Copy to clipboard
<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:
Copy to clipboard
$('.bg_image').cloudinary({ effect: "hue:50"});

All image 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 image effects. Should we support additional image effects? Any other image transformation features still missing?

Recent Blog Posts

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more