Tutorial Sections:
- Watch a Video
- Use-Cases for Named Transformations
- Creating a named transformation using the API
- Naming a Transformation Set in the Console
- Applying a Named Transformation to an Image or Video
- Creating a Named Transformation as a Preset
Named transformations are one of the most useful aspects of Cloudinary’s service, allowing for you to take one or more transformations you have created for your images and/or videos and develop a codename for them.
Watch a Video
- Music: Floating Through Time (SAW mix)
- Icons from Monkik, Payungkead, and Freepik
Use-Cases for Named Transformations
While there are dozens of use-cases for naming your Cloudinary transformation sets, here are the most common reasons to do so :
Shortening Your URLs
Imagine you have a large filename/public ID with a folder name that has many characters. Compound that with some sets of Cloudinary transformations and your URLs can get very lengthy, which can make it cumbersome for sharing with others. Naming the transformation set will essentially shorten it to one transformation in the URL structure, vastly reducing the original size.
Preventing Human Error
When applying transformations to an image or video, it can be easy to forget to add one or more in the process. As an example, wanting to apply these transformations - ar_1:1,bo_5px_solid_rgb:caa5c9,c_fill,f_webp,fl_awebp,g_face/f_jpg,g_south_east,l_samples:cloudinary-icon/ - to an image is asking you or your team to remember all of these parameters and to repeatedly apply them without any spelling or syntax errors. To help prevent human error in the process, you can group these parameters into one named transformation with the naming of your choice, such as “global”, “default” or whatever else you’d like to call it.
Adding Confidentiality and Security
Naming a transformation set hides the original transformation details from being in the URL. With a name like the earlier “t_global” example, nobody would know that you are using multiple, specific transformations for the image. This technique does add a certain level of security and not exposing all of your work to the world.
As you can see, this image is the same as this image. But the first exposes all the steps with its overly long URL, whereas the second is much shorter and concealed.
Go back to the top of the article.
Creating a named Transformation using the API
It's possible to create a named transformation using our admin API. You can do so in two main ways.
The first is to by sending a POST request with this syntax
POST /transformations/:name
The second is to use any of our SDK's and use the create_transformation method in order to create and name your transformation.
It's possible to see the relevant syntax for each SDK in our documentation
Go back to the top of the article.
Naming a Transformation Set in the Console
To create a named transformation from scratch:
1. Log into your Cloudinary Management Console.
2. Access your Media Library by selecting it from the top-navigation section.
3. Hover over the image you want to transform and select its Edit icon.
4. Begin developing your transformation with the tools in the Transformation section (left side of the image).
In this example, we’ll use certain parameters and apply the following transformations:
- A 1:1 aspect ratio (ar_1:1) to create an image that is equal on all sizes and resembles a perfect square.
- A 5-pixel-wide border that is solid and is a light pink color (bo_5px_solid_rgb:dfc2de)
- A crop that fills the space of the 1:1 aspect ratio, but retains the original image’s proportions (c_fill).
- Transcoding the image to use the best available file format, based on the user’s chosen browser (f_auto).
- Focus the crop on a face found in the image (g_face)
- Overlays the Cloudinary icon in the southeast corner of the image that is in the Media Library’s Samples folder (g_south_east,l_samples:cloudinary-icon)
Applying each transformation is lengthening the URL, which highlights the use-cases for a named transformation. It’s becoming too cumbersome to maintain and share.
Because of this, take the following steps to build your named transformation:
1. Go to your account’s Transformations by selecting it from the top-navigation section.
2. Find your transformation set in the list, then select its Edit link.
3. Select the Save As button. This should open up a pop-up window where you can enter your desired name for the transformation set.
The transformation name should now be changed to whatever you wrote in the pop-up window’s text field.
Go back to the top of the article.
Applying a Named Transformation to an Image or Video
After developing a named transformation, you can apply it to any image or video in your Cloudinary Media Library as you would with other transformations. Simply use the “t_” parameter and then the name of the transformation, i.e. “t_global”. Remember that transformations commonly go directly before the public ID in the URL structure.
Go back to the top of the article.
Creating a Named Transformation as a Preset
You can also add any named transformation as a preset by selecting the Add to Presets link, when you are viewing the transformation in the Transformations section.
After doing so, you can see the named transformation in the Media Library’s Manage section and easily apply the preset with the available options.
Note, that named transformations can also be configured via our Admin API.
For further details on named transformations, we recommend reviewing our official developer documentation and Knowledge Base, as well as this informative blog post from our friend David Walsh.
Go back to the top of the article.
Comments
4 comments
How can I create an overlay transformation of text?
Hey Laura, thanks for reaching out!
Text overlay can be easily added via the UI, by setting an overlay with the "text:" keyword, followed by the text options -
You can check the available options in our text overlay guide -
https://cloudinary.com/documentation/image_transformations#adding_text_captions
Hope this helps!
Hi all, is it possible to display different transformation presets for different users or user groups?
Hi Marvin,
You can select the various presets you want to display when you click on an asset but right now we cannot display different transformations for different users.
Please sign in to leave a comment.