Cloudinary Blog

Automatic image sharpening and blurring in the cloud

Images. Your web (or mobile) application is probably filled to the brim with images. You might be surprised at just how much impact these images have on your visitors. From their graphical appeal to their size and access times - these images determine your visitors browsing experience and ultimately their conversion to repeating visitors and paying clients.
Now, while your graphic designer has created a cool graphical concept, many of the images you need to embed inside it are not in your direct control. Social websites contain profile photos uploaded by their users. E-commerce solutions contain many product photos that can't be edited one at a time. Media outlets contain many photographs of different consistency.
Having a tool in your belt that offers automatic tweaks and retouches for all these images is quite handy. Here a couple of things you can do with Cloudinary that can really improve your website.

Image sharpening

How can you make your website "pop"? it's easy if you control the exact content across your web application - a great graphics design can make wonders. But what can we do to improve user uploaded images? 
Let's look look at the following image uploaded to Cloudinary:
The photo looks good. But just take a look at what a bit of sharpness can do to it. 
You can add sharpness by setting the effect transformation parameter to sharpen (or e_sharpen for URLs):
Here's the same example in Rails:
<%= cl_image_tag("front_face.jpg", :effect => "sharpen") %>
You can control the strength of the sharpen effect to match your taste. Here's a more intense sharpening of the same image by setting the sharpen level to 300. Quite a nice photographic effect.

Same example in PHP:
<?php echo cl_image_tag("front_face.jpg", array("effect" => "sharpen:300")) ?>
Sharpening is also useful in making text elements in thumbnails clearer. For example, the following screenshot was uploaded to Cloudinary. As you can see the small gray text snippets are not so clear here.
Sharpening such an screenshot would make the text more readable. The following example sharpened this image. This time using the unsharp_mask effect that is similar to sharpen but uses a different algorithm. Much more readable:
Same example in Django:
img = cloudinary.CloudinaryImage("front_face.jpg")

Image blurring

Image sharpening is useful for improving images and making them "pop". But sometimes you would want to aim for the opposite effect. Quora, for example, is using dynamically created blurred snippets of text if you're browsing an answer while being logged out. How can you do that using Cloudinary?
To blur images, you can use Cloudinary's blur effect (e_blur for URLs). Here's an example: 
You can also make the blurring more intense by passing a numeric level. The following example applies the blur effect with a 400 intensity on the sample image:
In the following example, we blurred the image intensely and also reduced its opacity. Then we added a text overlay that calls users to sign up to your site if they want to view the full content:
Sample example in Rails:
<%= cl_image_tag("front_face.jpg", 
                 :overlay => "text:bold_dark:Sign up to see more",
                 :gravity => :center,  
                 :transformation => {:effect => "blur:500", :opacity => 50}) %>
Sometimes you want to blur only a certain region of an image. You can use the blur_region effect together with exact coordinates specified by x, y, width and height parameters. Here's an example that blurs only part of an uploaded screenshot:
Same example in Node.js:
cloudinary.image("front_face.jpg", { effect: "blur_region", x: 0, y: 0.5, w: 1.0 });
You can also automatically blur all faces detected in an image using Cloudinary's blur_faces. In the following example the face was automatically detected and blurred using the default level:
Same example in .NET:
string url = cloudinary.Api.UrlImgUp.Transform(
  new CloudinaryDotNet.Transformation().Effect("blur_faces")).BuildUrl("front_face.jpg");


Automatic image sharpening and blurring can do wonders to a website. For static assets, you can do that manually using your favorite image manipulation software. With Cloudinary such effects can be automatically applied to millions of user-uploaded images with ease. And if you decide to spruce up the graphical effects in your site's images, you can simply modify the transformation parameters in your development framework of choice. All images will be regenerated on the fly using the updated effect and will be served to your users optimized through a fast CDN.
It would be great if you try out the new filters and tell us when you think. If you don't have a Cloudinary account yet, you can create one for free.

Recent Blog Posts

Analyze and auto tag images with Amazon Rekognition

Knowledge is power. And if you allow your users to upload images, you also probably want to better understand what their images contain. Whether a photo is of a building, people, animals, celebrities, or a product, image processing and analysis can assist in further comprehension. The benefits of this knowledge can go beyond "merely" categorizing your content and making your image library searchable: drawing insights from user generated content can be very useful! What better way to learn more about your users than to analyze the images they upload and find out what they care about and then have the ability to display relevant content to them according to their interests or even match them with other users that share similar interests.

Read more
Automatically moderate your user uploaded images

Allowing your users to upload their own images to your website can increase user engagement, retention and monetization. However, allowing your users to upload any image they want to, may lead to some of your users uploading inappropriate images to your application. These images may offend other users or even cause your site to violate standards or regulations.

Read more
Cloudinary Uses Scale API to Focus on Image Compression

Here at Cloudinary, we provide a cloud-based tool that enables our users to compress images and video for their websites and apps. Our goal is to preserve the visual integrity of the content, but deliver the smallest file size to any device or browser to ultimately optimize website performance and end user satisfaction.

Read more
CloudinaryAndroid SDK

Developing applications for mobile consumption requires facing, and overcoming, some difficult challenges. Apps need to limit their RAM, CPU and battery usage while still performing the required tasks in a reasonable time frame. If too many background tasks are running, the mobile device can become sluggish, with the battery running out very quickly. Coordination with other apps is crucial to keep the device responsive and make the battery last longer.

Read more
forLoop: Nigeria Event on Building for The Next Billion Users


Since Google shared their intent for the next billion internet users, some African developers thought this was pointing right at them and they needed to act fast. The mission to bring the next billion users from Africa to the internet kicked off a storm of enthusiasm. This community event turned into a success story and this is a summary of what happened.

Read more