Class: Imagekitio::Models::Transformation

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/imagekitio/models/transformation.rb,
sig/imagekitio/models/transformation.rbs

Defined Under Namespace

Modules: AIDropShadow, AIRemoveBackground, AIRemoveBackgroundExternal, AIRetouch, AIUpscale, AIVariation, AspectRatio, AudioCodec, ContrastStretch, Crop, CropMode, Duration, EndOffset, Flip, Format, Gradient, Grayscale, Height, Page, Radius, Rotation, Shadow, Sharpen, StartOffset, Trim, UnsharpMask, VideoCodec, Width, X, XCenter, Y, YCenter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#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) ⇒ Object

Some parameter documentations has been truncated, see Imagekitio::Models::Transformation for more details.

The SDK provides easy-to-use names for transformations. These names are converted to the corresponding transformation string before being added to the URL. SDKs are updated regularly to support new transformations. If you want to use a transformation that is not supported by the SDK, You can use the raw parameter to pass the transformation string directly. See the Transformations documentation.

Parameters:

  • ai_change_background (String) (defaults to: nil)

    Uses AI to change the background. Provide a text prompt or a base64-encoded prom

  • ai_drop_shadow (Boolean, true, String) (defaults to: nil)

    Adds an AI-based drop shadow around a foreground object on a transparent or remo

  • ai_edit (String) (defaults to: nil)

    Uses AI to edit images based on a text prompt. Provide a text prompt or a base64

  • ai_remove_background (Boolean, Imagekitio::Models::Transformation::AIRemoveBackground) (defaults to: nil)

    Applies ImageKit's in-house background removal.

  • ai_remove_background_external (Boolean, Imagekitio::Models::Transformation::AIRemoveBackgroundExternal) (defaults to: nil)

    Uses third-party background removal.

  • ai_retouch (Boolean, Imagekitio::Models::Transformation::AIRetouch) (defaults to: nil)

    Performs AI-based retouching to improve faces or product shots. Not supported in

  • ai_upscale (Boolean, Imagekitio::Models::Transformation::AIUpscale) (defaults to: nil)

    Upscales images beyond their original dimensions using AI. Not supported inside

  • ai_variation (Boolean, Imagekitio::Models::Transformation::AIVariation) (defaults to: nil)

    Generates a variation of an image using AI. This produces a new image with sligh

  • aspect_ratio (Float, String) (defaults to: nil)

    Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with e

  • audio_codec (Symbol, Imagekitio::Models::Transformation::AudioCodec) (defaults to: nil)

    Specifies the audio codec, e.g., aac, opus, or none. See [Audio codec](htt

  • background (String) (defaults to: nil)

    Specifies the background to be used in conjunction with certain cropping strateg

  • blur (Float) (defaults to: nil)

    Specifies the Gaussian blur level. Accepts an integer value between 1 and 100, o

  • border (String) (defaults to: nil)

    Adds a border to the output media. Accepts a string in the format `<border-width

  • colorize (String) (defaults to: nil)

    Applies a color tint to the image. Accepts color and intensity as optional param

  • color_profile (Boolean) (defaults to: nil)

    Indicates whether the output image should retain the original color profile.

  • color_replace (String) (defaults to: nil)

    Replaces colors in the image. Supports three formats:

  • contrast_stretch (Boolean, Imagekitio::Models::Transformation::ContrastStretch) (defaults to: nil)

    Automatically enhances the contrast of an image (contrast stretch).

  • crop (Symbol, Imagekitio::Models::Transformation::Crop) (defaults to: nil)

    Crop modes for image resizing. See [Crop modes & focus](https://imagekit.io/docs

  • crop_mode (Symbol, Imagekitio::Models::Transformation::CropMode) (defaults to: nil)

    Additional crop modes for image resizing. See [Crop modes & focus](https://image

  • default_image (String) (defaults to: nil)

    Specifies a fallback image if the resource is not found, e.g., a URL or file pat

  • distort (String) (defaults to: nil)

    Distorts the shape of an image. Supports two modes:

  • dpr (Float) (defaults to: nil)

    Accepts values between 0.1 and 5, or auto for automatic device pixel ratio (DP

  • duration (Float, String) (defaults to: nil)

    Specifies the duration (in seconds) for trimming videos, e.g., 5 or 10.5.

  • end_offset (Float, String) (defaults to: nil)

    Specifies the end offset (in seconds) for trimming videos, e.g., 5 or 10.5.

  • flip (Symbol, Imagekitio::Models::Transformation::Flip) (defaults to: nil)

    Flips or mirrors an image either horizontally, vertically, or both.

  • focus (String) (defaults to: nil)

    Refines padding and cropping behavior for pad resize, maintain ratio, and extrac

  • format_ (Symbol, Imagekitio::Models::Transformation::Format) (defaults to: nil)

    Specifies the output format for images or videos, e.g., jpg, png, webp, `m

  • gradient (Boolean, true, String) (defaults to: nil)

    Creates a linear gradient with two colors. Pass true for a default gradient, o

  • grayscale (Boolean, Imagekitio::Models::Transformation::Grayscale) (defaults to: nil)

    Enables a grayscale effect for images. See [Grayscale](https://imagekit.io/docs/

  • height (Float, String) (defaults to: nil)

    Specifies the height of the output. If a value between 0 and 1 is provided, it i

  • lossless (Boolean) (defaults to: nil)

    Specifies whether the output image (in JPEG or PNG) should be compressed lossles

  • metadata (Boolean) (defaults to: nil)

    By default, ImageKit removes all metadata during automatic image compression.

  • named (String) (defaults to: nil)

    Named transformation reference. See [Named transformations](https://imagekit.io/

  • opacity (Float) (defaults to: nil)

    Specifies the opacity level of the output image. See [Opacity](https://imagekit.

  • original (Boolean) (defaults to: nil)

    If set to true, serves the original file without applying any transformations.

  • overlay (Imagekitio::Models::Overlay) (defaults to: nil)

    Specifies an overlay to be applied on the parent image or video.

  • page (Float, String) (defaults to: nil)

    Extracts a specific page or frame from multi-page or layered files (PDF, PSD, AI

  • progressive (Boolean) (defaults to: nil)

    Specifies whether the output JPEG image should be rendered progressively. Progre

  • quality (Float) (defaults to: nil)

    Specifies the quality of the output image for lossy formats such as JPEG, WebP,

  • radius (Float, Symbol, :max, String) (defaults to: nil)

    Specifies the corner radius for rounded corners.

  • raw (String) (defaults to: nil)

    Pass any transformation not directly supported by the SDK.

  • rotation (Float, String) (defaults to: nil)

    Specifies the rotation angle in degrees. Positive values rotate the image clockw

  • shadow (Boolean, true, String) (defaults to: nil)

    Adds a shadow beneath solid objects in an image with a transparent background.

  • sharpen (Boolean, true, Float) (defaults to: nil)

    Sharpens the input image, highlighting edges and finer details.

  • start_offset (Float, String) (defaults to: nil)

    Specifies the start offset (in seconds) for trimming videos, e.g., 5 or 10.5

  • streaming_resolutions (Array<Symbol, Imagekitio::Models::StreamingResolution>) (defaults to: nil)

    An array of resolutions for adaptive bitrate streaming, e.g., [240, 360, `48

  • trim (Boolean, true, Float) (defaults to: nil)

    Useful for images with a solid or nearly solid background and a central object.

  • unsharp_mask (Boolean, true, String) (defaults to: nil)

    Applies Unsharp Masking (USM), an image sharpening technique.

  • video_codec (Symbol, Imagekitio::Models::Transformation::VideoCodec) (defaults to: nil)

    Specifies the video codec, e.g., h264, vp9, av1, or none. See [Video cod

  • width (Float, String) (defaults to: nil)

    Specifies the width of the output. If a value between 0 and 1 is provided, it is

  • x (Float, String) (defaults to: nil)

    Focus using cropped image coordinates - X coordinate. See [Focus using cropped c

  • x_center (Float, String) (defaults to: nil)

    Focus using cropped image coordinates - X center coordinate. See [Focus using cr

  • y_ (Float, String) (defaults to: nil)

    Focus using cropped image coordinates - Y coordinate. See [Focus using cropped c

  • y_center (Float, String) (defaults to: nil)

    Focus using cropped image coordinates - Y center coordinate. See [Focus using cr

  • zoom (Float) (defaults to: nil)

    Accepts a numeric value that determines how much to zoom in or out of the croppe



# File 'lib/imagekitio/models/transformation.rb', line 513

Instance Attribute Details

#ai_change_backgroundString?

Uses AI to change the background. Provide a text prompt or a base64-encoded prompt, e.g., prompt-snow road or prompte-[urlencoded_base64_encoded_text]. Not supported inside overlay. See AI Change Background.

Parameters:

  • (String)

Returns:

  • (String, nil)


13
# File 'lib/imagekitio/models/transformation.rb', line 13

optional :ai_change_background, String, api_name: :aiChangeBackground

#ai_drop_shadowBoolean, ...

Adds an AI-based drop shadow around a foreground object on a transparent or removed background. Optionally, control the direction, elevation, and saturation of the light source (e.g., az-45 to change light direction). Pass true for the default drop shadow, or provide a string for a custom drop shadow. Supported inside overlay. See AI Drop Shadow.

Returns:

  • (Boolean, true, String, nil)


24
25
26
27
28
# File 'lib/imagekitio/models/transformation.rb', line 24

optional :ai_drop_shadow,
union: -> {
  Imagekitio::Transformation::AIDropShadow
},
api_name: :aiDropShadow

#ai_editString?

Uses AI to edit images based on a text prompt. Provide a text prompt or a base64-encoded prompt, e.g., prompt-snow road or prompte-[urlencoded_base64_encoded_text]. Not supported inside overlay. See AI Edit.

Parameters:

  • (String)

Returns:

  • (String, nil)


37
# File 'lib/imagekitio/models/transformation.rb', line 37

optional :ai_edit, String, api_name: :aiEdit

#ai_remove_backgroundBoolean, ...

Applies ImageKit's in-house background removal. Supported inside overlay. See AI Background Removal.



44
45
46
# File 'lib/imagekitio/models/transformation.rb', line 44

optional :ai_remove_background,
enum: -> { Imagekitio::Transformation::AIRemoveBackground },
api_name: :aiRemoveBackground

#ai_remove_background_externalBoolean, ...

Uses third-party background removal. Note: It is recommended to use aiRemoveBackground, ImageKit's in-house solution, which is more cost-effective. Supported inside overlay. See External Background Removal.



55
56
57
# File 'lib/imagekitio/models/transformation.rb', line 55

optional :ai_remove_background_external,
enum: -> { Imagekitio::Transformation::AIRemoveBackgroundExternal },
api_name: :aiRemoveBackgroundExternal

#ai_retouchBoolean, ...

Performs AI-based retouching to improve faces or product shots. Not supported inside overlay. See AI Retouch.



65
# File 'lib/imagekitio/models/transformation.rb', line 65

optional :ai_retouch, enum: -> { Imagekitio::Transformation::AIRetouch }, api_name: :aiRetouch

#ai_upscaleBoolean, ...

Upscales images beyond their original dimensions using AI. Not supported inside overlay. See AI Upscale.



73
# File 'lib/imagekitio/models/transformation.rb', line 73

optional :ai_upscale, enum: -> { Imagekitio::Transformation::AIUpscale }, api_name: :aiUpscale

#ai_variationBoolean, ...

Generates a variation of an image using AI. This produces a new image with slight variations from the original, such as changes in color, texture, and other visual elements, while preserving the structure and essence of the original image. Not supported inside overlay. See AI Generate Variations.



83
# File 'lib/imagekitio/models/transformation.rb', line 83

optional :ai_variation, enum: -> { Imagekitio::Transformation::AIVariation }, api_name: :aiVariation

#aspect_ratioFloat, ...

Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with either width or height (but not both). For example: aspectRatio = 4:3, 4_3, or an expression like iar_div_2. See Image resize and crop – Aspect ratio.

Returns:

  • (Float, String, nil)


92
# File 'lib/imagekitio/models/transformation.rb', line 92

optional :aspect_ratio, union: -> { Imagekitio::Transformation::AspectRatio }, api_name: :aspectRatio

#audio_codecSymbol, ...

Specifies the audio codec, e.g., aac, opus, or none. See Audio codec.



99
# File 'lib/imagekitio/models/transformation.rb', line 99

optional :audio_codec, enum: -> { Imagekitio::Transformation::AudioCodec }, api_name: :audioCodec

#backgroundString?

Specifies the background to be used in conjunction with certain cropping strategies when resizing an image.

  • A solid color: e.g., red, F3F3F3, AAFF0010. See Solid color background.
  • Dominant color: dominant extracts the dominant color from the image. See Dominant color background.
  • Gradient: gradient_dominant or gradient_dominant_2 creates a gradient using the dominant colors. Optionally specify palette size (2 or 4), e.g., gradient_dominant_4. See Gradient background.
  • A blurred background: e.g., blurred, blurred_25_N15, etc. See Blurred background.
  • Expand the image boundaries using generative fill: genfill. Not supported inside overlay. Optionally, control the background scene by passing a text prompt: genfill[:-prompt-${text}] or genfill[:-prompte-${urlencoded_base64_encoded_text}]. See Generative fill background.

Parameters:

  • (String)

Returns:

  • (String, nil)


122
# File 'lib/imagekitio/models/transformation.rb', line 122

optional :background, String

#blurFloat?

Specifies the Gaussian blur level. Accepts an integer value between 1 and 100, or an expression like bl-10. See Blur.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


130
# File 'lib/imagekitio/models/transformation.rb', line 130

optional :blur, Float

#borderString?

Adds a border to the output media. Accepts a string in the format <border-width>_<hex-code> (e.g., 5_FFF000 for a 5px yellow border), or an expression like ih_div_20_FF00FF. See Border.

Parameters:

  • (String)

Returns:

  • (String, nil)


139
# File 'lib/imagekitio/models/transformation.rb', line 139

optional :border, String

#color_profileBoolean?

Indicates whether the output image should retain the original color profile. See Color profile.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


158
# File 'lib/imagekitio/models/transformation.rb', line 158

optional :color_profile, Imagekitio::Internal::Type::Boolean, api_name: :colorProfile

#color_replaceString?

Replaces colors in the image. Supports three formats:

  • toColor - Replace dominant color with the specified color.
  • toColor_tolerance - Replace dominant color with specified tolerance (0-100).
  • toColor_tolerance_fromColor - Replace a specific color with another within tolerance range. Colors can be hex codes (e.g., FF0022) or names (e.g., red, blue). See Color replacement.

Parameters:

  • (String)

Returns:

  • (String, nil)


171
# File 'lib/imagekitio/models/transformation.rb', line 171

optional :color_replace, String, api_name: :colorReplace

#colorizeString?

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 100. See Colorize.

Parameters:

  • (String)

Returns:

  • (String, nil)


151
# File 'lib/imagekitio/models/transformation.rb', line 151

optional :colorize, String

#contrast_stretchBoolean, ...

Automatically enhances the contrast of an image (contrast stretch). See Contrast Stretch.



178
179
180
# File 'lib/imagekitio/models/transformation.rb', line 178

optional :contrast_stretch,
enum: -> { Imagekitio::Transformation::ContrastStretch },
api_name: :contrastStretch

#cropSymbol, ...

Crop modes for image resizing. See Crop modes & focus.



187
# File 'lib/imagekitio/models/transformation.rb', line 187

optional :crop, enum: -> { Imagekitio::Transformation::Crop }

#crop_modeSymbol, ...

Additional crop modes for image resizing. See Crop modes & focus.



194
# File 'lib/imagekitio/models/transformation.rb', line 194

optional :crop_mode, enum: -> { Imagekitio::Transformation::CropMode }, api_name: :cropMode

#default_imageString?

Specifies a fallback image if the resource is not found, e.g., a URL or file path. See Default image.

Parameters:

  • (String)

Returns:

  • (String, nil)


202
# File 'lib/imagekitio/models/transformation.rb', line 202

optional :default_image, String, api_name: :defaultImage

#distortString?

Distorts the shape of an image. Supports two modes:

  • Perspective distortion: p-x1_y1_x2_y2_x3_y3_x4_y4 changes the position of the four corners starting clockwise from top-left.
  • Arc distortion: a-degrees curves the image upwards (positive values) or downwards (negative values). See Distort effect.

Parameters:

  • (String)

Returns:

  • (String, nil)


214
# File 'lib/imagekitio/models/transformation.rb', line 214

optional :distort, String

#dprFloat?

Accepts values between 0.1 and 5, or auto for automatic device pixel ratio (DPR) calculation. Also accepts arithmetic expressions.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


225
# File 'lib/imagekitio/models/transformation.rb', line 225

optional :dpr, Float

#durationFloat, ...

Specifies the duration (in seconds) for trimming videos, e.g., 5 or 10.5. Typically used with startOffset to indicate the length from the start offset. Arithmetic expressions are supported. See Trim videos – Duration.

Returns:

  • (Float, String, nil)


234
# File 'lib/imagekitio/models/transformation.rb', line 234

optional :duration, union: -> { Imagekitio::Transformation::Duration }

#end_offsetFloat, ...

Specifies the end offset (in seconds) for trimming videos, e.g., 5 or 10.5. Typically used with startOffset to define a time window. Arithmetic expressions are supported. See Trim videos – End offset.

Returns:

  • (Float, String, nil)


243
# File 'lib/imagekitio/models/transformation.rb', line 243

optional :end_offset, union: -> { Imagekitio::Transformation::EndOffset }, api_name: :endOffset

#flipSymbol, ...

Flips or mirrors an image either horizontally, vertically, or both. Acceptable values: h (horizontal), v (vertical), h_v (horizontal and vertical), or v_h. See Flip.



251
# File 'lib/imagekitio/models/transformation.rb', line 251

optional :flip, enum: -> { Imagekitio::Transformation::Flip }

#focusString?

Refines padding and cropping behavior for pad resize, maintain ratio, and extract crop modes. Supports manual positions and coordinate-based focus. With AI-based cropping, you can automatically keep key subjects in frame—such as faces or detected objects (e.g., fo-face, fo-person, fo-car)— while resizing.

Parameters:

  • (String)

Returns:

  • (String, nil)


264
# File 'lib/imagekitio/models/transformation.rb', line 264

optional :focus, String

#format_Symbol, ...

Specifies the output format for images or videos, e.g., jpg, png, webp, mp4, or auto. You can also pass orig for images to return the original format. ImageKit automatically delivers images and videos in the optimal format based on device support unless overridden by the dashboard settings or the format parameter. See Image format and Video format.



276
# File 'lib/imagekitio/models/transformation.rb', line 276

optional :format_, enum: -> { Imagekitio::Transformation::Format }, api_name: :format

#gradientBoolean, ...

Creates a linear gradient with two colors. Pass true for a default gradient, or provide a string for a custom gradient. See Gradient.

Returns:

  • (Boolean, true, String, nil)


284
# File 'lib/imagekitio/models/transformation.rb', line 284

optional :gradient, union: -> { Imagekitio::Transformation::Gradient }

#grayscaleBoolean, ...

Enables a grayscale effect for images. See Grayscale.



291
# File 'lib/imagekitio/models/transformation.rb', line 291

optional :grayscale, enum: -> { Imagekitio::Transformation::Grayscale }

#heightFloat, ...

Specifies the height of the output. If a value between 0 and 1 is provided, it is treated as a percentage (e.g., 0.5 represents 50% of the original height). You can also supply arithmetic expressions (e.g., ih_mul_0.5). Height transformation – Images · Videos

Returns:

  • (Float, String, nil)


302
# File 'lib/imagekitio/models/transformation.rb', line 302

optional :height, union: -> { Imagekitio::Transformation::Height }

#losslessBoolean?

Specifies whether the output image (in JPEG or PNG) should be compressed losslessly. See Lossless compression.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


310
# File 'lib/imagekitio/models/transformation.rb', line 310

optional :lossless, Imagekitio::Internal::Type::Boolean

#metadataBoolean?

By default, ImageKit removes all metadata during automatic image compression. Set this to true to preserve metadata. See Image metadata.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


318
# File 'lib/imagekitio/models/transformation.rb', line 318

optional :metadata, Imagekitio::Internal::Type::Boolean

#namedString?

Named transformation reference. See Named transformations.

Parameters:

  • (String)

Returns:

  • (String, nil)


325
# File 'lib/imagekitio/models/transformation.rb', line 325

optional :named, String

#opacityFloat?

Specifies the opacity level of the output image. See Opacity.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


332
# File 'lib/imagekitio/models/transformation.rb', line 332

optional :opacity, Float

#originalBoolean?

If set to true, serves the original file without applying any transformations. See Deliver original file as-is.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


340
# File 'lib/imagekitio/models/transformation.rb', line 340

optional :original, Imagekitio::Internal::Type::Boolean

#overlayImagekitio::Models::Overlay?

Specifies an overlay to be applied on the parent image or video. ImageKit supports overlays including images, text, videos, subtitles, and solid colors. See Overlay using layers.

Parameters:

  • (Imagekitio::Models::overlay)

Returns:



349
# File 'lib/imagekitio/models/transformation.rb', line 349

optional :overlay, union: -> { Imagekitio::Overlay }

#pageFloat, ...

Extracts a specific page or frame from multi-page or layered files (PDF, PSD, AI). For example, specify by number (e.g., 2), a range (e.g., 3-4 for the 2nd and 3rd layers), or by name (e.g., name-layer-4 for a PSD layer). See Thumbnail extraction.

Returns:

  • (Float, String, nil)


358
# File 'lib/imagekitio/models/transformation.rb', line 358

optional :page, union: -> { Imagekitio::Transformation::Page }

#progressiveBoolean?

Specifies whether the output JPEG image should be rendered progressively. Progressive loading begins with a low-quality, pixelated version of the full image, which gradually improves to provide a faster perceived load time. See Progressive images.

Parameters:

  • (Boolean)

Returns:

  • (Boolean, nil)


367
# File 'lib/imagekitio/models/transformation.rb', line 367

optional :progressive, Imagekitio::Internal::Type::Boolean

#qualityFloat?

Specifies the quality of the output image for lossy formats such as JPEG, WebP, and AVIF. A higher quality value results in a larger file size with better quality, while a lower value produces a smaller file size with reduced quality. See Quality.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


376
# File 'lib/imagekitio/models/transformation.rb', line 376

optional :quality, Float

#radiusFloat, ...

Specifies the corner radius for rounded corners.

  • Single value (positive integer): Applied to all corners (e.g., 20).
  • max: Creates a circular or oval shape.
  • Per-corner array: Provide four underscore-separated values representing top-left, top-right, bottom-right, and bottom-left corners respectively (e.g., 10_20_30_40). See Radius.

Returns:

  • (Float, Symbol, :max, String, nil)


389
# File 'lib/imagekitio/models/transformation.rb', line 389

optional :radius, union: -> { Imagekitio::Transformation::Radius }

#rawString?

Pass any transformation not directly supported by the SDK. This transformation string is appended to the URL as provided.

Parameters:

  • (String)

Returns:

  • (String, nil)


396
# File 'lib/imagekitio/models/transformation.rb', line 396

optional :raw, String

#rotationFloat, ...

Specifies the rotation angle in degrees. Positive values rotate the image clockwise; you can also use, for example, N40 for counterclockwise rotation or auto to use the orientation specified in the image's EXIF data. For videos, only the following values are supported: 0, 90, 180, 270, or 360. See Rotate.

Returns:

  • (Float, String, nil)


406
# File 'lib/imagekitio/models/transformation.rb', line 406

optional :rotation, union: -> { Imagekitio::Transformation::Rotation }

#shadowBoolean, ...

Adds a shadow beneath solid objects in an image with a transparent background. For AI-based drop shadows, refer to aiDropShadow. Pass true for a default shadow, or provide a string for a custom shadow. See Shadow.

Returns:

  • (Boolean, true, String, nil)


415
# File 'lib/imagekitio/models/transformation.rb', line 415

optional :shadow, union: -> { Imagekitio::Transformation::Shadow }

#sharpenBoolean, ...

Sharpens the input image, highlighting edges and finer details. Pass true for default sharpening, or provide a numeric value for custom sharpening. See Sharpen.

Returns:

  • (Boolean, true, Float, nil)


423
# File 'lib/imagekitio/models/transformation.rb', line 423

optional :sharpen, union: -> { Imagekitio::Transformation::Sharpen }

#start_offsetFloat, ...

Specifies the start offset (in seconds) for trimming videos, e.g., 5 or 10.5. Arithmetic expressions are also supported. See Trim videos – Start offset.

Returns:

  • (Float, String, nil)


431
# File 'lib/imagekitio/models/transformation.rb', line 431

optional :start_offset, union: -> { Imagekitio::Transformation::StartOffset }, api_name: :startOffset

#streaming_resolutionsArray<Symbol, Imagekitio::Models::StreamingResolution>?

An array of resolutions for adaptive bitrate streaming, e.g., [240, 360, 480, 720, 1080]. See Adaptive Bitrate Streaming.

Returns:



439
440
441
# File 'lib/imagekitio/models/transformation.rb', line 439

optional :streaming_resolutions,
-> { Imagekitio::Internal::Type::ArrayOf[enum: Imagekitio::StreamingResolution] },
api_name: :streamingResolutions

#trimBoolean, ...

Useful for images with a solid or nearly solid background and a central object. This parameter trims the background, leaving only the central object in the output image. See Trim edges.

Returns:

  • (Boolean, true, Float, nil)


450
# File 'lib/imagekitio/models/transformation.rb', line 450

optional :trim, union: -> { Imagekitio::Transformation::Trim }

#unsharp_maskBoolean, ...

Applies Unsharp Masking (USM), an image sharpening technique. Pass true for a default unsharp mask, or provide a string for a custom unsharp mask. See Unsharp Mask.

Returns:

  • (Boolean, true, String, nil)


458
# File 'lib/imagekitio/models/transformation.rb', line 458

optional :unsharp_mask, union: -> { Imagekitio::Transformation::UnsharpMask }, api_name: :unsharpMask

#video_codecSymbol, ...

Specifies the video codec, e.g., h264, vp9, av1, or none. See Video codec.



465
# File 'lib/imagekitio/models/transformation.rb', line 465

optional :video_codec, enum: -> { Imagekitio::Transformation::VideoCodec }, api_name: :videoCodec

#widthFloat, ...

Specifies the width of the output. If a value between 0 and 1 is provided, it is treated as a percentage (e.g., 0.4 represents 40% of the original width). You can also supply arithmetic expressions (e.g., iw_div_2). Width transformation – Images · Videos

Returns:

  • (Float, String, nil)


475
# File 'lib/imagekitio/models/transformation.rb', line 475

optional :width, union: -> { Imagekitio::Transformation::Width }

#xFloat, ...

Focus using cropped image coordinates - X coordinate. See Focus using cropped coordinates.

Returns:

  • (Float, String, nil)


482
# File 'lib/imagekitio/models/transformation.rb', line 482

optional :x, union: -> { Imagekitio::Transformation::X }

#x_centerFloat, ...

Focus using cropped image coordinates - X center coordinate. See Focus using cropped coordinates.

Returns:

  • (Float, String, nil)


489
# File 'lib/imagekitio/models/transformation.rb', line 489

optional :x_center, union: -> { Imagekitio::Transformation::XCenter }, api_name: :xCenter

#y_Float, ...

Focus using cropped image coordinates - Y coordinate. See Focus using cropped coordinates.

Returns:

  • (Float, String, nil)


496
# File 'lib/imagekitio/models/transformation.rb', line 496

optional :y_, union: -> { Imagekitio::Transformation::Y }, api_name: :y

#y_centerFloat, ...

Focus using cropped image coordinates - Y center coordinate. See Focus using cropped coordinates.

Returns:

  • (Float, String, nil)


503
# File 'lib/imagekitio/models/transformation.rb', line 503

optional :y_center, union: -> { Imagekitio::Transformation::YCenter }, api_name: :yCenter

#zoomFloat?

Accepts a numeric value that determines how much to zoom in or out of the cropped area. It should be used in conjunction with fo-face or fo-<object_name>. See Zoom.

Parameters:

  • (Float)

Returns:

  • (Float, nil)


511
# File 'lib/imagekitio/models/transformation.rb', line 511

optional :zoom, Float

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/imagekitio/models/transformation.rb', line 662

.variantsArray(Float, String)

Returns:

  • (Array(Float, String))


# File 'lib/imagekitio/models/transformation.rb', line 649

Instance Method Details

#to_hash{

Returns:

  • ({)


407
# File 'sig/imagekitio/models/transformation.rbs', line 407

def to_hash: -> {