Skip to content
Open
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
github.repository == 'stainless-sdks/imagekit-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
Expand All @@ -39,7 +39,7 @@ jobs:
github.repository == 'stainless-sdks/imagekit-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());

Expand All @@ -60,9 +60,9 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
Expand All @@ -76,9 +76,9 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/imagekit-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.repository == 'imagekit-developer/imagekit-ruby' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Check release environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.4.1"
".": "4.5.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 47
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-c7f578172392bde58bbb72be2a25b9e917529cd07550358c645ce155debf2418.yml
openapi_spec_hash: f0d797a17b1e8e81707517700cd44b13
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-ad6dd3b4acf289708568a12574b997503059a47c4a4ca5ffefe64f40f3d3dbf3.yml
openapi_spec_hash: 7c103e2dff0edcbeea82057e62f58d4d
config_hash: 94f48fd13b7d41b8b6a203a3a8cee9ed
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 4.5.0 (2026-05-13)

Full Changelog: [v4.4.1...v4.5.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.4.1...v4.5.0)

### Features

* **api:** add no-enlarge crop modes and colorize transformation ([1b56303](https://github.com/imagekit-developer/imagekit-ruby/commit/1b56303ef5c67cb1a4b36d4a1c06b147f22c5987))
* support setting headers via env ([cd32783](https://github.com/imagekit-developer/imagekit-ruby/commit/cd32783efe49d795b8a5de49eb44039cda375d2e))
* **transformation:** add colorize transformation support in URL generation ([3454064](https://github.com/imagekit-developer/imagekit-ruby/commit/34540646f7ee8a1deabeea629f366d28bc71f734))


### Chores

* **internal:** codegen related update ([7e0543d](https://github.com/imagekit-developer/imagekit-ruby/commit/7e0543d8714ff251de1a32f471dc7bd8bfa17dab))

## 4.4.1 (2026-04-24)

Full Changelog: [v4.4.0...v4.4.1](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.4.0...v4.4.1)
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
imagekitio (4.4.1)
imagekitio (4.5.0)
cgi
connection_pool
standardwebhooks
Expand Down Expand Up @@ -144,7 +144,7 @@ GEM
rexml (>= 3.2.6)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
standardwebhooks (1.0.1)
standardwebhooks (1.1.0)
steep (1.10.0)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "imagekitio", "~> 4.4.1"
gem "imagekitio", "~> 4.5.0"
```

<!-- x-release-please-end -->
Expand Down
16 changes: 15 additions & 1 deletion lib/imagekitio/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ def initialize(
raise ArgumentError.new("private_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_KEY\"")
end

headers = {}
custom_headers_env = ENV["IMAGE_KIT_CUSTOM_HEADERS"]
unless custom_headers_env.nil?
parsed = {}
custom_headers_env.split("\n").each do |line|
colon = line.index(":")
unless colon.nil?
parsed[line[0...colon].strip] = line[(colon + 1)..].strip
end
end
headers = parsed.merge(headers)
end

@private_key = private_key.to_s
@password = password.to_s
@webhook_secret = webhook_secret&.to_s
Expand All @@ -129,7 +142,8 @@ def initialize(
timeout: timeout,
max_retries: max_retries,
initial_retry_delay: initial_retry_delay,
max_retry_delay: max_retry_delay
max_retry_delay: max_retry_delay,
headers: headers
)

@custom_metadata_fields = Imagekitio::Resources::CustomMetadataFields.new(client: self)
Expand Down
1 change: 1 addition & 0 deletions lib/imagekitio/helpers/transformation_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module TransformationUtils
"gradient" => "e-gradient",
"color_replace" => "cr",
"colorReplace" => "cr",
"colorize" => "e-colorize",
"distort" => "e-distort",

# Other flags & finishing
Expand Down
19 changes: 18 additions & 1 deletion lib/imagekitio/models/transformation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ class Transformation < Imagekitio::Internal::Type::BaseModel
# @return [String, nil]
optional :border, String

# @!attribute colorize
# 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).
#
# @return [String, nil]
optional :colorize, String

# @!attribute color_profile
# 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 @@ -498,7 +510,7 @@ class Transformation < Imagekitio::Internal::Type::BaseModel
# @return [Float, nil]
optional :zoom, Float

# @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, color_profile: nil, color_replace: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, distort: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil)
# @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, colorize: nil, color_profile: nil, color_replace: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, distort: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil)
# Some parameter documentations has been truncated, see
# {Imagekitio::Models::Transformation} for more details.
#
Expand Down Expand Up @@ -535,6 +547,8 @@ class Transformation < Imagekitio::Internal::Type::BaseModel
#
# @param border [String] Adds a border to the output media. Accepts a string in the format `<border-width
#
# @param colorize [String] Applies a color tint to the image. Accepts color and intensity as optional param
#
# @param color_profile [Boolean] Indicates whether the output image should retain the original color profile.
#
# @param color_replace [String] Replaces colors in the image. Supports three formats:
Expand Down Expand Up @@ -765,6 +779,7 @@ module Crop
AT_MAX_ENLARGE = :at_max_enlarge
AT_LEAST = :at_least
MAINTAIN_RATIO = :maintain_ratio
MAINTAIN_RATIO_NO_ENLARGE = :maintain_ratio_no_enlarge

# @!method self.values
# @return [Array<Symbol>]
Expand All @@ -780,6 +795,8 @@ module CropMode
PAD_RESIZE = :pad_resize
EXTRACT = :extract
PAD_EXTRACT = :pad_extract
PAD_RESIZE_NO_ENLARGE = :pad_resize_no_enlarge
PAD_EXTRACT_NO_SHRINK = :pad_extract_no_shrink

# @!method self.values
# @return [Array<Symbol>]
Expand Down
2 changes: 1 addition & 1 deletion lib/imagekitio/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Imagekitio
VERSION = "4.4.1"
VERSION = "4.5.0"
end
38 changes: 38 additions & 0 deletions rbi/imagekitio/models/transformation.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,19 @@ module Imagekitio
sig { params(border: String).void }
attr_writer :border

# 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).
sig { returns(T.nilable(String)) }
attr_reader :colorize

sig { params(colorize: String).void }
attr_writer :colorize

# Indicates whether the output image should retain the original color profile. See
# [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp).
sig { returns(T.nilable(T::Boolean)) }
Expand Down Expand Up @@ -664,6 +677,7 @@ module Imagekitio
background: String,
blur: Float,
border: String,
colorize: String,
color_profile: T::Boolean,
color_replace: String,
contrast_stretch:
Expand Down Expand Up @@ -785,6 +799,14 @@ module Imagekitio
# expression like `ih_div_20_FF00FF`. See
# [Border](https://imagekit.io/docs/effects-and-enhancements#border---b).
border: nil,
# 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: nil,
# Indicates whether the output image should retain the original color profile. See
# [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp).
color_profile: nil,
Expand Down Expand Up @@ -998,6 +1020,7 @@ module Imagekitio
background: String,
blur: Float,
border: String,
colorize: String,
color_profile: T::Boolean,
color_replace: String,
contrast_stretch:
Expand Down Expand Up @@ -1285,6 +1308,11 @@ module Imagekitio
T.let(:at_least, Imagekitio::Transformation::Crop::TaggedSymbol)
MAINTAIN_RATIO =
T.let(:maintain_ratio, Imagekitio::Transformation::Crop::TaggedSymbol)
MAINTAIN_RATIO_NO_ENLARGE =
T.let(
:maintain_ratio_no_enlarge,
Imagekitio::Transformation::Crop::TaggedSymbol
)

sig do
override.returns(
Expand Down Expand Up @@ -1313,6 +1341,16 @@ module Imagekitio
:pad_extract,
Imagekitio::Transformation::CropMode::TaggedSymbol
)
PAD_RESIZE_NO_ENLARGE =
T.let(
:pad_resize_no_enlarge,
Imagekitio::Transformation::CropMode::TaggedSymbol
)
PAD_EXTRACT_NO_SHRINK =
T.let(
:pad_extract_no_shrink,
Imagekitio::Transformation::CropMode::TaggedSymbol
)

sig do
override.returns(
Expand Down
24 changes: 22 additions & 2 deletions sig/imagekitio/models/transformation.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Imagekitio
background: String,
blur: Float,
border: String,
colorize: String,
color_profile: bool,
color_replace: String,
contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch,
Expand Down Expand Up @@ -127,6 +128,10 @@ module Imagekitio

def border=: (String) -> String

attr_reader colorize: String?

def colorize=: (String) -> String

attr_reader color_profile: bool?

def color_profile=: (bool) -> bool
Expand Down Expand Up @@ -355,6 +360,7 @@ module Imagekitio
?background: String,
?blur: Float,
?border: String,
?colorize: String,
?color_profile: bool,
?color_replace: String,
?contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch,
Expand Down Expand Up @@ -412,6 +418,7 @@ module Imagekitio
background: String,
blur: Float,
border: String,
colorize: String,
color_profile: bool,
color_replace: String,
contrast_stretch: Imagekitio::Models::Transformation::contrast_stretch,
Expand Down Expand Up @@ -544,7 +551,12 @@ module Imagekitio
end

type crop =
:force | :at_max | :at_max_enlarge | :at_least | :maintain_ratio
:force
| :at_max
| :at_max_enlarge
| :at_least
| :maintain_ratio
| :maintain_ratio_no_enlarge

module Crop
extend Imagekitio::Internal::Type::Enum
Expand All @@ -554,18 +566,26 @@ module Imagekitio
AT_MAX_ENLARGE: :at_max_enlarge
AT_LEAST: :at_least
MAINTAIN_RATIO: :maintain_ratio
MAINTAIN_RATIO_NO_ENLARGE: :maintain_ratio_no_enlarge

def self?.values: -> ::Array[Imagekitio::Models::Transformation::crop]
end

type crop_mode = :pad_resize | :extract | :pad_extract
type crop_mode =
:pad_resize
| :extract
| :pad_extract
| :pad_resize_no_enlarge
| :pad_extract_no_shrink

module CropMode
extend Imagekitio::Internal::Type::Enum

PAD_RESIZE: :pad_resize
EXTRACT: :extract
PAD_EXTRACT: :pad_extract
PAD_RESIZE_NO_ENLARGE: :pad_resize_no_enlarge
PAD_EXTRACT_NO_SHRINK: :pad_extract_no_shrink

def self?.values: -> ::Array[Imagekitio::Models::Transformation::crop_mode]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ def test_should_generate_the_correct_url_with_many_transformations_including_vid
# New transformations
color_replace: "FF0000_50_0000FF",
distort: "p-100_50_200_150_300_250_400_350",
colorize: "co-FF0000_in-15",
original: true,
page: "2_4",
raw: "h-200,w-300,l-image,i-logo.png,l-end"
Expand All @@ -449,7 +450,7 @@ def test_should_generate_the_correct_url_with_many_transformations_including_vid
)
)

expected = "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,cr-FF0000_50_0000FF,e-distort-p-100_50_200_150_300_250_400_350,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end"
expected = "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,cr-FF0000_50_0000FF,e-distort-p-100_50_200_150_300_250_400_350,e-colorize-co-FF0000_in-15,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end"
assert_equal(expected, url)
end

Expand Down
Loading