Cloudinary Blog

Image manipulation recipes in the cloud. The Cloudinary Cookbook

Image manipulation recipes in the cloud

How do you crop an image to a custom shape? How do you add a shadow effect to an image with transparency? How do you add text overlay to an image without using HTML?

If you build or maintain a website with a lot of images, you've probably had many questions like these. Most developers who work with images have scripts or tools that can achieve dozens if not hundreds of image manipulations - from basics like crop and resize, to advanced stuff like shadow and transparency, watermarks, face detection, etc. But how do you mix and match these manipulations correctly to solve a problem or achieve a certain effect?

Cloudinary is a cloud-based image management service that lets you upload your website's images to the cloud, and perform a large variety of image manipulations on them. Our customers frequently share with us new, exciting and occasionally surprising results achieved by mixing and matching from Cloudinary's image manipulation toolset. We wanted to share these experiences with you, in the form of the Cloudinary Cookbook.

The Cloudinary Cookbook is a collection of examples showing how to do complex things with images, by combining different image manipulations, or tweaking a specific manipulation to achieve a certain result. The cookbook is built of recipes that include sample images, code in all development frameworks, tips and guidelines and links to additional resources.

For those who don't yet use Cloudinary, our Cookbook should provide some inspiration about cool things you can achieve with just a few image manipulations put together. But note that some of our examples include advanced manipulations that are unique to Cloudinary :) For new or existing users, the cookbook will be a way to learn from others' experiences or from the Cloudinary team's knowledge, and achieve cool effects much faster, with code samples you can copy-paste (with minor changes) into your software project.

Using the Cookbook - Cloudinary's collection of image manipulation examples

The Cloudinary Cookbook is available here:

Our cookbook consists of recipes. The most popular ones are listed in the main page, which you can see in the screenshot below. Each recipe is assigned with one or more tags; click a tag to browse recipes by subject. On the main page or tag pages you can see snippets of recipes with thumbnails of some of the example images, a short description and the code that generates the image effect.

Cloudinary does image manipulations on-the-fly in the cloud, using a dynamic URL that specifies exactly how the image should be modified. You can provide this image manipulation URL directly, or use our client libraries for Ruby on Rails, PHP, Python/Django, Node.js, Java, .Net or jQuery, to construct the required image manipulation URL with a single line of code.

Cookbook recipes

Each recipe snippet includes an example of an image manipulation URL that could generate this image, and code samples that show how to build this URL with the transformation parameters that need to be applied. Click on the tabs of the framework names to view the sample code for the development framework you use.

Cookbook recipe snippet

Clicking on a recipe snippet leads you to the full recipe page. As you can see below, in the full page, larger images are displayed, there are additional image manipulation examples, code samples, and more details on how the manipulations work.

You can comment on each specific recipe, like it on Facebook or share it on Twitter or Google+, and also add your comment in the thread at the bottom of the page.

Cookbook recipe page

We're working on adding many more recipes, most of them requested or suggested by our users. We already have a few dozen recipes available, including cropping image to a custom shape, face-detection based image cropping, using images as text textures, adding watermarks as overlay images, add shadow effect to an image, auto-generating a photo collage and more.

Summary

Cloudinary's service is not just about image manipulation (we also provide cloud storage of images, optimized delivery via CDN, image administration and management), but it’s a key component of our service. Our image manipulation capabilities are rich and always expanding. You can resize and crop images based on face detection, rotate photos, add overlays and watermarks, add text layers, adjust colors, apply effects and filters, chain multiple transformations, and much more.

Since Cloudinary's service was publicly launched more than two years ago, our customers kept surprising us with an impressive set of results they generated using the image manipulation ingredients that we provide. In addition, we kept expanding our manipulation capabilities according to the requests of many of our customers. The new Cloudinary Cookbook is the place for Cloudinary users to share the results they've been generating with our cloud-based image manipulation features.

We have big plans for the Cookbook - we're already working on dozens of additional recipes, and are encouraging our users to share their cool recipes with the community and to vote on recipes of other users. Do you have a tried-and-tested recipe of your own? Contact us, let us know and we'll be happy to add it to the Cookbook.

Recent Blog Posts

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