# Image transformation

Source: https://developers.swell.is/guides/image-transformation

Swell's file CDN supports basic size transformations for image files by appending query parameters to the file URL. To request a specific sized image from the CDN, take the `url` field from the file object and add parameters for width, height, or both with the size in pixels as the value. See the reference and examples below for more details on how each parameter works.

### Reference

#### width

`Integer`

Sets maximum width of the image in pixels. Original aspect ratio is preserved if no `height` value is provided. When used in conjunction with `height`, image will be cropped or padded depending on the `anchor` and `padded` values.

#### height

`Integer`

Sets maximum height of the image in pixels. Original aspect ratio is preserved if no `width` value is provided. When used in conjunction with `width`, image will be cropped or padded depending on the `anchor` and `padded` values.

#### anchor

`top|right|bottom|left`

Affects cropped area when both `width` and `height` are specified, or what side white space is added when `padded=true`. Note that cropping is always performed on the shortest side(s) of the image.

#### padded

`Boolean`

Indicates the image should be padded with white space to fit within the desired `width` and `height`. Use in conjunction with `anchor` to specify where the white space should be added. Note that padding is always added to the longest side(s) of the image.

### Examples

![CDN transform parameter examples](https://cdn.sanity.io/images/ecf33d4l/production/b3ca80584c74a0302f9406987ee578c441bca4bd-1580x1580.png)
