Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 5.4.0

1. **Enhancement:**
- Added support for new crop modes: `maintain_ratio_no_enlarge`, `pad_resize_no_enlarge` and `pad_extract_no_shrink`
- Added support for `colorize` transformation

## Version 5.3.0

1. **Enhancement:**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@imagekit/javascript",
"version": "5.3.0",
"version": "5.4.0",
"description": "ImageKit Javascript SDK",
"main": "dist/imagekit.cjs.js",
"module": "dist/imagekit.esm.js",
Expand Down
1 change: 1 addition & 0 deletions src/constants/supportedTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const supportedTransforms: { [key: string]: string } = {
gradient: "e-gradient",
colorReplace: "cr",
distort: "e-distort",
colorize: "e-colorize",

// Other flags & finishing
progressive: "pr",
Expand Down
15 changes: 13 additions & 2 deletions src/interfaces/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,17 @@ export interface Transformation {
*/
border?: string;

/**
* Applies a color tint to the image. Accepts color and intensity as optional
* parameters.
*
* - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray
* color.
* - `in-intensity` - Intensity of the color (0-100). Default is 35. See
* [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize).
*/
colorize?: string;

/**
* Indicates whether the output image should retain the original color profile. See
* [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp).
Expand Down Expand Up @@ -1442,13 +1453,13 @@ export interface Transformation {
* Crop modes for image resizing. See
* [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
*/
crop?: 'force' | 'at_max' | 'at_max_enlarge' | 'at_least' | 'maintain_ratio';
crop?: 'force' | 'at_max' | 'at_max_enlarge' | 'at_least' | 'maintain_ratio' | 'maintain_ratio_no_enlarge';

/**
* Additional crop modes for image resizing. See
* [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
*/
cropMode?: 'pad_resize' | 'extract' | 'pad_extract';
cropMode?: 'pad_resize' | 'extract' | 'pad_extract' | 'pad_resize_no_enlarge' | 'pad_extract_no_shrink';

/**
* Specifies a fallback image if the resource is not found, e.g., a URL or file
Expand Down
3 changes: 2 additions & 1 deletion test/url-generation/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1279,13 +1279,14 @@ describe("URL generation", function () {
raw: "h-200,w-300,l-image,i-logo.png,l-end",
// New transformation parameters
colorReplace: 'FF0000_50_00FF00',
colorize: 'co-red_in-35',
distort: 'p-50_50_150_50_150_150_50_150',
}
]
});

expect(url).equal(
`https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end,cr-FF0000_50_00FF00,e-distort-p-50_50_150_50_150_150_50_150`
`https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end,cr-FF0000_50_00FF00,e-colorize-co-red_in-35,e-distort-p-50_50_150_50_150_150_50_150`
);
});
});
Loading