A transformation is essentially one or more instructions that tell Cloudinary how to change the properties of a media asset. Cloudinary transformations are displayed as abbreviated parameters directly in the URL that accesses the media.
What are named transformations?
Named transformations allow you to take one or more transformations, and group them under a unique custom name.
Once a named transformation has been defined, calling that named transformation would apply all of the transformations in that set without the need to specifically perform each one.
For example, if we take the below image with this URL:
we could apply the below transformations to it:
- Changing the width of the image to be 300px and the height 200px using `h_200,w_300`
- Scaling the image to fit the requested dimensions using `c_scale`
- Improving the quality of the image using the improve effect: `e_improve`
- Applying a quality optimization to the image to retain the quality while still decreasing its size using `q_auto:good`
Applying all of these transformations would make the URL look like the below:
We could use a named transformation to group all of the above transformations under one name. In this case, we created a named transformation called `improved`. By calling just that one named transformation, all of the transformations we previously defined in that set would be applied:
It's possible to read a more comprehensive guide about named transformation in our documentation
What are named transformations good for?
Named transformations are great if you have a set of transformations that you are using regularly, or a complex transformation used often. Defining a named transformation for that set of transformations would allow us to easily apply the entire set without repeating it every time.
Another reason for using named transformation might be if you wont to disguise a specific set of transformation from being publicly known. Creating a named transformation for that transformation set would display only the named transformation on the resource url rather than the entire set.
How to define named transformations
Why can't I use `q_auto` or `f_auto` in a named transformation?
When using the
f_auto parameter, the actual format to be fetched is determined on the CDN level. Therefore the
f_auto component must remain visible to the CDN and cannot be used within a named-transformation.
In addition, the
q_auto component cannot be used within a named-transformation as well. this is because the mode of the
q_auto parameter to be used is dependant on the browser receiving the resource. Note that using the
q_auto:[Mode] component can be used in a named transformation since the resolution of that is not dependent on the browser.
You can read more about
q_auto being used in named transformations here