Skip to content

Commit c4ddf30

Browse files
feat(api): add no-enlarge crop modes and colorize transformation
- Add `maintain_ratio_no_enlarge` to `crop` enum - Add `pad_resize_no_enlarge` and `pad_extract_no_shrink` to `cropMode` enum - Add `colorize` transformation parameter for applying color tints
1 parent 7965712 commit c4ddf30

4 files changed

Lines changed: 45 additions & 6 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 48
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-362d0336e8f52ab1beb7d9602a3665dbb0277700e8dc01ef4f96fc7651699349.yml
3-
openapi_spec_hash: f0d797a17b1e8e81707517700cd44b13
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-ad6dd3b4acf289708568a12574b997503059a47c4a4ca5ffefe64f40f3d3dbf3.yml
3+
openapi_spec_hash: 7c103e2dff0edcbeea82057e62f58d4d
44
config_hash: 94f48fd13b7d41b8b6a203a3a8cee9ed

src/imagekitio/types/shared/transformation.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ class Transformation(BaseModel):
137137
[Border](https://imagekit.io/docs/effects-and-enhancements#border---b).
138138
"""
139139

140+
colorize: Optional[str] = None
141+
"""Applies a color tint to the image.
142+
143+
Accepts color and intensity as optional parameters.
144+
145+
- `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray
146+
color.
147+
- `in-intensity` - Intensity of the color (0-100). Default is 35. See
148+
[Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize).
149+
"""
150+
140151
color_profile: Optional[bool] = FieldInfo(alias="colorProfile", default=None)
141152
"""
142153
Indicates whether the output image should retain the original color profile. See
@@ -160,14 +171,18 @@ class Transformation(BaseModel):
160171
[Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast).
161172
"""
162173

163-
crop: Optional[Literal["force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio"]] = None
174+
crop: Optional[
175+
Literal["force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio", "maintain_ratio_no_enlarge"]
176+
] = None
164177
"""Crop modes for image resizing.
165178
166179
See
167180
[Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
168181
"""
169182

170-
crop_mode: Optional[Literal["pad_resize", "extract", "pad_extract"]] = FieldInfo(alias="cropMode", default=None)
183+
crop_mode: Optional[
184+
Literal["pad_resize", "extract", "pad_extract", "pad_resize_no_enlarge", "pad_extract_no_shrink"]
185+
] = FieldInfo(alias="cropMode", default=None)
171186
"""Additional crop modes for image resizing.
172187
173188
See

src/imagekitio/types/shared_params/transformation.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ class Transformation(TypedDict, total=False):
135135
[Border](https://imagekit.io/docs/effects-and-enhancements#border---b).
136136
"""
137137

138+
colorize: str
139+
"""Applies a color tint to the image.
140+
141+
Accepts color and intensity as optional parameters.
142+
143+
- `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray
144+
color.
145+
- `in-intensity` - Intensity of the color (0-100). Default is 35. See
146+
[Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize).
147+
"""
148+
138149
color_profile: Annotated[bool, PropertyInfo(alias="colorProfile")]
139150
"""
140151
Indicates whether the output image should retain the original color profile. See
@@ -158,14 +169,17 @@ class Transformation(TypedDict, total=False):
158169
[Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast).
159170
"""
160171

161-
crop: Literal["force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio"]
172+
crop: Literal["force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio", "maintain_ratio_no_enlarge"]
162173
"""Crop modes for image resizing.
163174
164175
See
165176
[Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
166177
"""
167178

168-
crop_mode: Annotated[Literal["pad_resize", "extract", "pad_extract"], PropertyInfo(alias="cropMode")]
179+
crop_mode: Annotated[
180+
Literal["pad_resize", "extract", "pad_extract", "pad_resize_no_enlarge", "pad_extract_no_shrink"],
181+
PropertyInfo(alias="cropMode"),
182+
]
169183
"""Additional crop modes for image resizing.
170184
171185
See

tests/api_resources/test_dummy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def test_method_create_with_all_params(self, client: ImageKit) -> None:
142142
"background": "red",
143143
"blur": 10,
144144
"border": "5_FF0000",
145+
"colorize": "colorize",
145146
"color_profile": True,
146147
"color_replace": "colorReplace",
147148
"contrast_stretch": True,
@@ -259,6 +260,7 @@ def test_method_create_with_all_params(self, client: ImageKit) -> None:
259260
"background": "red",
260261
"blur": 10,
261262
"border": "5_FF0000",
263+
"colorize": "colorize",
262264
"color_profile": True,
263265
"color_replace": "colorReplace",
264266
"contrast_stretch": True,
@@ -466,6 +468,7 @@ def test_method_create_with_all_params(self, client: ImageKit) -> None:
466468
"background": "red",
467469
"blur": 10,
468470
"border": "5_FF0000",
471+
"colorize": "colorize",
469472
"color_profile": True,
470473
"color_replace": "colorReplace",
471474
"contrast_stretch": True,
@@ -651,6 +654,7 @@ def test_method_create_with_all_params(self, client: ImageKit) -> None:
651654
"background": "red",
652655
"blur": 10,
653656
"border": "5_FF0000",
657+
"colorize": "colorize",
654658
"color_profile": True,
655659
"color_replace": "colorReplace",
656660
"contrast_stretch": True,
@@ -762,6 +766,7 @@ def test_method_create_with_all_params(self, client: ImageKit) -> None:
762766
"background": "red",
763767
"blur": 10,
764768
"border": "5_FF0000",
769+
"colorize": "colorize",
765770
"color_profile": True,
766771
"color_replace": "colorReplace",
767772
"contrast_stretch": True,
@@ -998,6 +1003,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncImageKit)
9981003
"background": "red",
9991004
"blur": 10,
10001005
"border": "5_FF0000",
1006+
"colorize": "colorize",
10011007
"color_profile": True,
10021008
"color_replace": "colorReplace",
10031009
"contrast_stretch": True,
@@ -1115,6 +1121,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncImageKit)
11151121
"background": "red",
11161122
"blur": 10,
11171123
"border": "5_FF0000",
1124+
"colorize": "colorize",
11181125
"color_profile": True,
11191126
"color_replace": "colorReplace",
11201127
"contrast_stretch": True,
@@ -1322,6 +1329,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncImageKit)
13221329
"background": "red",
13231330
"blur": 10,
13241331
"border": "5_FF0000",
1332+
"colorize": "colorize",
13251333
"color_profile": True,
13261334
"color_replace": "colorReplace",
13271335
"contrast_stretch": True,
@@ -1507,6 +1515,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncImageKit)
15071515
"background": "red",
15081516
"blur": 10,
15091517
"border": "5_FF0000",
1518+
"colorize": "colorize",
15101519
"color_profile": True,
15111520
"color_replace": "colorReplace",
15121521
"contrast_stretch": True,
@@ -1618,6 +1627,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncImageKit)
16181627
"background": "red",
16191628
"blur": 10,
16201629
"border": "5_FF0000",
1630+
"colorize": "colorize",
16211631
"color_profile": True,
16221632
"color_replace": "colorReplace",
16231633
"contrast_stretch": True,

0 commit comments

Comments
 (0)