Image enhancement & color manipulation
Image enhancement
Contrast stretch - (e-contrast)
It is used to automatically enhance the contrast of the image by using the full intensity values that particular image format allows. This means that the lighter sections of an image become even lighter and the darker sections becomes even brighter, thereby enhancing the contrast.
Sharpen - (e-sharpen)
It is used to sharpen the input image. It is useful when highlighting the edges and finer details within an image.
Example usage - e-sharpen-<number>
If just the e-sharpen parameter is used, then a default sharpening is performed on the input image. The default behaviour can be controlled by specifying a number that restricts the extent of sharpening performed.
Unsharp mask - (e-usm)
Unsharp Masking (USM) is an image sharpening technique. This transform allows you to apply and control unsharp masks on your images.
Example usage - e-usm-<radius>-<sigma>-<amount>-<threshold>
The amount of sharpening can be varied using 4 parameters - radius
, sigma
, amount
, and threshold
. This results in perceptually better images compared to using e-sharpen. Only positive floating points are allowed for these 4 parameters.
Shadow - (e-shadow)
This feature adds a shadow under solid objects in an input image with a transparent background.
The shadow is applied under the areas constituted by the non-transparent pixels in the input image. You can adjust the shadow's saturation, blur level, and positional offsets with the following parameters.
Parameter | Description | Range | Default value |
---|---|---|---|
Blur ( | Adjusts the blur level of the shadow. e.g. |
|
|
Saturation ( | Specifies the saturation level of the shadow. e.g. |
|
|
X Offset ( | Sets the horizontal offset of the shadow by x% of the image width. e.g. |
|
|
Y Offset ( | Sets the vertical offset of the shadow by y% of the image height. e.g. |
|
|
Multiple parameters can be configured by appending them with an underscore (_
). They will be applied independent of the order in which they are specified.
Example usage - e-shadow-<blur>_<saturation>_<x-offset>_<y-offset>
, which would look like, e-shadow-bl-15_st-40_x-10_y-N5
.
Limits
Shadows can only be applied to images with a resolution of maximum 2MP. Images with resolutions outside this limit will return a "400 - Bad Request" error.
To enable shadows on images larger than 2MP, you can resize the images either in the same chain or a chained transformation.
e.g. For a 3MP image, e-shadow
would not work. But w-500,e-shadow
or w-500:e-shadow
would work.
We have an input image with dimensions 2216x1500 (3MP). Applying only the shadow transformation will return an error with status code 400: https://ik.imagekit.io/demo/tr:e-shadow/lipstick_2M.png
.
Resize the image as follows to apply a shadow successfully:
Gradient - (e-gradient)
This is used to add a gradient overlay over an input image.
The gradient formed is a linear gradient containing two colors, and it can be customised with the following parameters:
Parameter | Description | Value Type | Range | Default Value |
---|---|---|---|---|
Linear Direction ( | Optional.
Sets the direction vector of the linear gradient.
For enhanced control over the direction, this parameter also accepts an integer in the range |
| Number - |
|
From Color ( | Optional.
It is used to specify a starting / first color for the gradient i.e. the starting point of the gradient will have this color in its pure form.
RGBA Code (e.g. |
| An SVG recognized color keyword name eg. |
|
To Color ( | Optional.
It is used to specify the second color for the gradient and will be blended with the |
| An SVG recognized color keyword name eg. |
|
Stop Point ( | Optional.
It is used to dictate where the break point should be made between the |
| Number - A floating point number between |
|
Multiple parameters can be configured by appending them with an underscore (_
). They will be applied independent of the order in which they are specified.
Example usage - e-gradient-<linear-direction>_<from-color>_<to-color>_<stop-point>
, which would look like, e-gradient-ld-top_right_from-FF000040_to-00FF0040_sp-0.9
.
Gradient as a background
For input images containing a solid object over a transparent background, gradient can also be applied as an underlay.
Usage syntax
Examples
If you experience a positional displacement between the original image and the overlay image, use t-false
to disable default trimming of the overlay layer like l-image,i-your-image.png,t-false,l-end
.
Adding gradient blocks over images
You can also add a gradient block over an input image.
Usage syntax
You can also control the position of the gradient color overlay using these positional parameters.
Transformation of gradient block overlay
Following transformation parameters are supported on the gradient block overlay inside a layer.
Parameter | Description |
---|---|
w | Width of the gradient block. It can also accept arithmetic expressions such as |
h | Height of the gradient block. It can also accept arithmetic expressions such as |
It is used to control the radius of the corner and accepts an integer value as the input. |
If you're looking to add a solid color block overlay instead, read more about it here.
Examples
Last updated