---
title: "ImageTransform"
description: "ImageTransform"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/swift/reference/imagetransform"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-06"
---

# ImageTransform

## ImageTransform

The Image Delivery API is used to retrieve, manipulate and/or convert image files of your Contentstack account and deliver it to your web or mobile properties.

## auto()

The auto parameter lets you enable the functionality that automates certain image optimization features.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().auto()
let result = urlString.url(with: transform)
```

## quality(_:)

The quality parameter lets you control the compression level of images that have Lossy file format. The value for this parameters can be entered in any whole number (taken as a percentage) between 1 and 100.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().quality(10)
let result = urlString.url(with: transform)
```

## format(_:)

The format parameter lets you converts a given image from one format to another.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().format(Format.gif)
let result = urlString.url(with: transform)
```

## resize(_:)

The width parameter lets you dynamically resize the width of the image by specifying pixels or percentage. The height parameter lets you dynamically resize the height of the image by specifying pixels or percentage. The disable parameter disables the functionality that is enabled by default.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().resize(Resize(size: Size(width: width)))
let result = urlString.url(with: transform)
```

## crop(_:)

The crop parameter allows you to remove pixels from an image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().crop(.offset(width: 100, height: 100, xOffset: 0.5, yOffset: 0.7))
let result = urlString.url(with: transform)
```

## canvas(_:)

The canvas parameter allows you to increase the size of the canvas that surrounds an image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().canvas(.offset(width: 100, height: 100, xOffset: 0.5, yOffset: 0.7))
let result = urlString.url(with: transform)
```

## fit(_:)

The fit parameter enables you to fit the given image properly within the specified height and width. You need to provide values for the height, width and fit parameters.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().fit(.bounds(Size(width: 100, height: 100)))
let result = urlString.url(with: transform)
```

## trim(_:)

The trim parameter lets you trim an image from the edges.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().trim(NSEdgeInsets(top: 50, left: 20, bottom: 50, right: 20))
let result = urlString.url(with: transform)
```

## orient(_:)

The orient parameter lets you control the cardinal orientation of the given image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().orient(.default)
let result = urlString.url(with: transform)
```

## overlay(relativeUrl:overlayTypes:)

The overlay parameter allows you to put one image on top of another. You need to specify the relative URL of the image as value for this parameter.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let relativeUrl = "<RELATIVE_URL>"
let transform = ImageTransform().overlay(relativeUrl: relativeUrl, 
                 overlayTypes: [
                    .align(.left),
                    .repeat(.both),
                    .size(Size(width: width, height: height))
                 ]))
let result = urlString.url(with: transform)
```

## overlay(relativeUrl:padding:)

The overlay-pad parameter allows you to add padding pixels to the edges of an overlay image. You need to specify the relative URL of the image as value for this parameter.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let relativeUrl = "<RELATIVE_URL>"
let transform = ImageTransform().overlay(relativeUrl: relativeUrl, padding: NSEdgeInsets(top: 50, left: 20, bottom: 50, right: 20))
let result = urlString.url(with: transform)
```

## pad(_:)

The pad parameter lets you add extra pixels to the edges of an image. This is useful if you want to add whitespace or border to an image. The value for this parameter can be given in pixels or percentage.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().pad(NSEdgeInsets(top: 50, left: 20, bottom: 50, right: 20))
let result = urlString.url(with: transform)
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().pad(UIEdgeInsets(top: 50, left: 20, bottom: 50, right: 20))
let result = urlString.url(with: transform)
```

## backgroundColor(_:)

The bg-color parameter lets you set a backgroud color for the given image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().backgroundColor(.hex("AAFF00")))
let result = urlString.url(with: transform)
```

## dpr(_:resize:)

The dpr parameter lets you deliver images with appropriate size to devices that come with a defined device pixel ratio.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().dpr(1000, resize: Resize(size: Size(width: 320))))
let result = urlString.url(with: transform)
```

## blur(_:)

The blur parameter allows you to decrease the focus and clarity of a given image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().blur(10)
let result = urlString.url(with: transform)
```

## saturation(_:)

The saturation parameter allows you to increase or decrease the intensity of the colors in a given image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().saturation(10)
let result = urlString.url(with: transform)
```

## contrast(_:)

The contrast parameter allows you to increase or decrease the difference between the darkest and lightest tones in a given image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().contrast(10)
let result = urlString.url(with: transform)
```

## brightness(_:)

The brightness parameter allows you to increase or decrease the intensity with which an image reflects or radiates perceived light.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().brightness(10)
let result = urlString.url(with: transform)
```

## fetchFirstFrame()

The frame parameter fetches the first frame from an animated GIF (Graphics Interchange Format) file that comprises a sequence of moving images.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().fetchFirstFrame()
let result = urlString.url(with: transform)
```

## sharpen(amount:radius:threshold:)

The sharpen parameter allows you to increase the definition of the edges of objects in an image.

```
let urlString = "<IMAGE_URL_TO_TRANSFORM>"
let transform = ImageTransform().sharpen(amount: 11, radius: 2, threshold: 100)
let result = urlString.url(with: transform)
```

## ImageTransform | Swift Delivery SDK | Contentstack

ImageTransform lets you retrieve, manipulate, and convert image files for delivery to your properties via the Swift Delivery SDK.