Here is a list of transformation parameters to perform basic image resizing and cropping:
Used to specify the width of the output image. Accepts integer value greater than 1. If a value between 0 and 1 is specified, it acts as a percentage width. Therefore, 0.1 means 10% of the original width, 0.4 means 40% of the original width, and so on. https://ik.imagekit.io/demo/tr:w-200/medium_cafe_B1iTdD0C.jpg
Used to specify the height of the output image. Accepts integer value greater than 1. If a value between 0 and 1 is specified, the value acts as a percentage height. Therefore, 0.1 means 10% of the original height, 0.4 means 40% of the original height, and so on. https://ik.imagekit.io/demo/tr:h-200/medium_cafe_B1iTdD0C.jpg
ar aspect ratio
Used to specify the aspect ratio of the output image or the ratio of width to height of the output image. This parameter must be used along with either the height(h) or width(w) parameter. The format for specifying this transformation is
This parameter decides the final value of the height and width of the output image, based on the aspect ratio of the input image and the requested transform. Possible values for this parameter include
cm crop mode
Used to specify how the input image is used for cropping to get the output image. Possible values for this parameter include
This parameter is coupled with the 'extract' type of crop mode, to specify the area of the input image that must be focussed on to get the output image. Possible values include
Used to specify the quality of the output image for lossy formats like JPEG and WebP. A large quality number indicates a larger output image size with high quality. A small quality number indicates a smaller output image size with lower quality.
Default Value -
Used to specify the format of the output image. If no output image format is specified and the 'USE BEST FORMAT FOR IMAGE DELIVERY' option is selected within your dashboard, the output image's format is decided based on the end user's device capabilities and other factors. If the 'USE BEST FORMAT FOR IMAGE DELIVERY' is not selected, and on output format is specified, then the format of the output image is the same as the input image. Possible values include
Used to specify the gaussian blur that must be applied to an image. The value of 'bl' specifies the radius of the 'Gaussian Blur' that is to be applied. Higher the value, larger the radius of Gaussian Blur. Possible values include integers between
Used to turn an image to a grayscale version. https://ik.imagekit.io/demo/tr:h-300,e-grayscale/sample_image.jpg
Used to specify the device pixel ratio that is used to calculate the dimensions of the output image. Extremely helpful when creating image transformations for devices with high device pixel ratio (DPR > 1), like the iPhone or high-end Android devices.
n named transformations
Named Transformations are an alias for the entire transformation string.
For example, we can create a named transformation -
di default image
When an image that is requested using Imagekit.io does not exist, a 404 error is displayed. In certain scenarios, you would want a default image to be delivered instead of the 404 error message. Imagekit.io provides an alternative to achieve this without having to make changes at the application level using this parameter. The image specified in this parameter should be accessible using the default endpoint of your ImageKit.io account. https://ik.imagekit.io/demo/tr:di-medium_cafe_B1iTdD0C.jpg/non_existent_image.jpg
pr progressive images
Used to specify whether the output JPEG image must be rendered progressively. In progressive loading, the output image renders as a low quality pixelated full image which over time keeps on adding more pixels and information to the image. This helps you maintain a fast perceived load time.
lo Lossless WebP and PNG
Used to specify whether the output image (if in JPEG or PNG) must be compressed losslessly. In lossless compression, the output file size is larger than the regular lossy compression. However, the perceived image quality can be higher in certain cases, especially for computer-generated graphics. Using lossless compression for photographs is not recommended.
t trim edges
Useful with images that have a solid or nearly solid background with the object in the center. This parameter trims the background from the image, leaving only the central object in the output image.
Possible Values include