- Watch a Video
- Use-Cases for Named Transformations
- 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
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.
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.
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.
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.
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.
There is no limit on how many presets you can create. Because of this, you could potentially add all of your account’s named transformations as presets.