Skip to content

Commit ad25990

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 3fe3963 commit ad25990

4 files changed

Lines changed: 39 additions & 12 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

aliases.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ const TransformationCropAtLeast = shared.TransformationCropAtLeast
831831
// Equals "maintain_ratio"
832832
const TransformationCropMaintainRatio = shared.TransformationCropMaintainRatio
833833

834+
// Equals "maintain_ratio_no_enlarge"
835+
const TransformationCropMaintainRatioNoEnlarge = shared.TransformationCropMaintainRatioNoEnlarge
836+
834837
// Additional crop modes for image resizing. See
835838
// [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
836839
//
@@ -846,6 +849,12 @@ const TransformationCropModeExtract = shared.TransformationCropModeExtract
846849
// Equals "pad_extract"
847850
const TransformationCropModePadExtract = shared.TransformationCropModePadExtract
848851

852+
// Equals "pad_resize_no_enlarge"
853+
const TransformationCropModePadResizeNoEnlarge = shared.TransformationCropModePadResizeNoEnlarge
854+
855+
// Equals "pad_extract_no_shrink"
856+
const TransformationCropModePadExtractNoShrink = shared.TransformationCropModePadExtractNoShrink
857+
849858
// Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
850859
// Typically used with startOffset to indicate the length from the start offset.
851860
// Arithmetic expressions are supported. See

dummy_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ func TestDummyNewWithOptionalParams(t *testing.T) {
174174
Background: imagekit.String("red"),
175175
Blur: imagekit.Float(10),
176176
Border: imagekit.String("5_FF0000"),
177+
Colorize: imagekit.String("colorize"),
177178
ColorProfile: imagekit.Bool(true),
178179
ColorReplace: imagekit.String("colorReplace"),
179180
ContrastStretch: true,
@@ -370,6 +371,7 @@ func TestDummyNewWithOptionalParams(t *testing.T) {
370371
Background: imagekit.String("red"),
371372
Blur: imagekit.Float(10),
372373
Border: imagekit.String("5_FF0000"),
374+
Colorize: imagekit.String("colorize"),
373375
ColorProfile: imagekit.Bool(true),
374376
ColorReplace: imagekit.String("colorReplace"),
375377
ContrastStretch: true,
@@ -713,6 +715,7 @@ func TestDummyNewWithOptionalParams(t *testing.T) {
713715
Background: imagekit.String("red"),
714716
Blur: imagekit.Float(10),
715717
Border: imagekit.String("5_FF0000"),
718+
Colorize: imagekit.String("colorize"),
716719
ColorProfile: imagekit.Bool(true),
717720
ColorReplace: imagekit.String("colorReplace"),
718721
ContrastStretch: true,
@@ -1012,6 +1015,7 @@ func TestDummyNewWithOptionalParams(t *testing.T) {
10121015
Background: imagekit.String("red"),
10131016
Blur: imagekit.Float(10),
10141017
Border: imagekit.String("5_FF0000"),
1018+
Colorize: imagekit.String("colorize"),
10151019
ColorProfile: imagekit.Bool(true),
10161020
ColorReplace: imagekit.String("colorReplace"),
10171021
ContrastStretch: true,
@@ -1202,6 +1206,7 @@ func TestDummyNewWithOptionalParams(t *testing.T) {
12021206
Background: imagekit.String("red"),
12031207
Blur: imagekit.Float(10),
12041208
Border: imagekit.String("5_FF0000"),
1209+
Colorize: imagekit.String("colorize"),
12051210
ColorProfile: imagekit.Bool(true),
12061211
ColorReplace: imagekit.String("colorReplace"),
12071212
ContrastStretch: true,

shared/shared.go

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,6 +4306,14 @@ type TransformationParam struct {
43064306
// expression like `ih_div_20_FF00FF`. See
43074307
// [Border](https://imagekit.io/docs/effects-and-enhancements#border---b).
43084308
Border param.Opt[string] `json:"border,omitzero"`
4309+
// Applies a color tint to the image. Accepts color and intensity as optional
4310+
// parameters.
4311+
//
4312+
// - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray
4313+
// color.
4314+
// - `in-intensity` - Intensity of the color (0-100). Default is 35. See
4315+
// [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize).
4316+
Colorize param.Opt[string] `json:"colorize,omitzero"`
43094317
// Indicates whether the output image should retain the original color profile. See
43104318
// [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp).
43114319
ColorProfile param.Opt[bool] `json:"colorProfile,omitzero"`
@@ -4438,12 +4446,14 @@ type TransformationParam struct {
44384446
// Crop modes for image resizing. See
44394447
// [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
44404448
//
4441-
// Any of "force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio".
4449+
// Any of "force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio",
4450+
// "maintain_ratio_no_enlarge".
44424451
Crop TransformationCrop `json:"crop,omitzero"`
44434452
// Additional crop modes for image resizing. See
44444453
// [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
44454454
//
4446-
// Any of "pad_resize", "extract", "pad_extract".
4455+
// Any of "pad_resize", "extract", "pad_extract", "pad_resize_no_enlarge",
4456+
// "pad_extract_no_shrink".
44474457
CropMode TransformationCropMode `json:"cropMode,omitzero"`
44484458
// Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`.
44494459
// Typically used with startOffset to indicate the length from the start offset.
@@ -4669,21 +4679,24 @@ const (
46694679
type TransformationCrop string
46704680

46714681
const (
4672-
TransformationCropForce TransformationCrop = "force"
4673-
TransformationCropAtMax TransformationCrop = "at_max"
4674-
TransformationCropAtMaxEnlarge TransformationCrop = "at_max_enlarge"
4675-
TransformationCropAtLeast TransformationCrop = "at_least"
4676-
TransformationCropMaintainRatio TransformationCrop = "maintain_ratio"
4682+
TransformationCropForce TransformationCrop = "force"
4683+
TransformationCropAtMax TransformationCrop = "at_max"
4684+
TransformationCropAtMaxEnlarge TransformationCrop = "at_max_enlarge"
4685+
TransformationCropAtLeast TransformationCrop = "at_least"
4686+
TransformationCropMaintainRatio TransformationCrop = "maintain_ratio"
4687+
TransformationCropMaintainRatioNoEnlarge TransformationCrop = "maintain_ratio_no_enlarge"
46774688
)
46784689

46794690
// Additional crop modes for image resizing. See
46804691
// [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus).
46814692
type TransformationCropMode string
46824693

46834694
const (
4684-
TransformationCropModePadResize TransformationCropMode = "pad_resize"
4685-
TransformationCropModeExtract TransformationCropMode = "extract"
4686-
TransformationCropModePadExtract TransformationCropMode = "pad_extract"
4695+
TransformationCropModePadResize TransformationCropMode = "pad_resize"
4696+
TransformationCropModeExtract TransformationCropMode = "extract"
4697+
TransformationCropModePadExtract TransformationCropMode = "pad_extract"
4698+
TransformationCropModePadResizeNoEnlarge TransformationCropMode = "pad_resize_no_enlarge"
4699+
TransformationCropModePadExtractNoShrink TransformationCropMode = "pad_extract_no_shrink"
46874700
)
46884701

46894702
// Only one field can be non-zero.

0 commit comments

Comments
 (0)