# Effects & Adjustments

This page documents all operations for applying visual effects, transformations, and spacing to images.

### Blur

```
bl:%sigma
```

Applies a Gaussian blur to the image. Higher sigma values produce a stronger blur effect.

| Parameter | Type  | Default  | Allowed Values     |
| --------- | ----- | -------- | ------------------ |
| sigma     | float | disabled | Any positive float |

**Examples:**

```
# Light blur
bl:3

# Strong blur (good for background overlays)
bl:15

# Subtle blur
bl:1.5
```

**Rewrite rule example — blurred hero backgrounds:**

Regex: `^/hero-bg/(.*)` Target: `/_sx/img/_/rs:fill:1920:600/bl:15/q:70/plain/$1`

A request to `/hero-bg/media/banner.jpg` delivers a 1920×600 blurred version of the image, perfect for placing text over.

***

### Sharpen

```
sh:%sigma
```

Applies a sharpening filter to the image. Use this to enhance image detail, especially after resizing.

| Parameter | Type  | Default  | Allowed Values     |
| --------- | ----- | -------- | ------------------ |
| sigma     | float | disabled | Any positive float |

As an approximate guideline:

| Sigma | Use case                        |
| ----- | ------------------------------- |
| `0.5` | Screen display (\~4 pixels/mm)  |
| `1.0` | Print at 12 pixels/mm           |
| `1.5` | Print at 300 DPI (16 pixels/mm) |

**Examples:**

```
# Light sharpening for web display
sh:0.5

# Moderate sharpening
sh:1.0
```

***

### Pixelate

```
pix:%size
```

Applies a pixelation filter to the image. The `size` parameter defines the size of each pixel block in the output.

| Parameter | Type    | Default  | Allowed Values       |
| --------- | ------- | -------- | -------------------- |
| size      | integer | disabled | Any positive integer |

**Examples:**

```
# Moderate pixelation
pix:8

# Heavy pixelation (strong anonymization)
pix:20
```

**Rewrite rule example — pixelated preview images:**

Regex: `^/preview/(.*)` Target: `/_sx/img/_/rs:fit:400:400/pix:10/q:60/plain/$1`

***

### Rotate

```
rot:%angle
```

Rotates the image clockwise by the specified angle. Only 90-degree increments are supported. The EXIF orientation is applied before rotation unless [auto-rotation](#auto-rotate) is disabled.

| Parameter | Type    | Default | Allowed Values                            |
| --------- | ------- | ------- | ----------------------------------------- |
| angle     | integer | `0`     | `0`, `90`, `180`, `270` (multiples of 90) |

**Examples:**

```
# Rotate 90° clockwise
rot:90

# Rotate 180° (flip upside down)
rot:180

# Rotate 270° clockwise (= 90° counter-clockwise)
rot:270
```

***

### Auto Rotate

```
ar:%auto_rotate
```

Controls automatic rotation based on EXIF Orientation metadata. When enabled, smoxy reads the orientation tag from the image metadata and rotates the image accordingly. The orientation tag is always removed from the output regardless of this setting.

| Parameter    | Type    | Default | Allowed Values                                           |
| ------------ | ------- | ------- | -------------------------------------------------------- |
| auto\_rotate | boolean | `true`  | `1`, `t`, `true` to enable; `0`, `f`, `false` to disable |

**Example:**

```
# Disable auto-rotation
ar:false
```

***

### Background

```
bg:%R:%G:%B
bg:%hex_color
```

Sets the background color used when converting images with transparency (e.g., PNG to JPEG), for [padding](#padding), and for [extend](https://docs.smoxy.eu/en/resizing-and-cropping#extend) operations.

| Parameter  | Type    | Default | Allowed Values                                 |
| ---------- | ------- | ------- | ---------------------------------------------- |
| R          | integer | —       | 0–255                                          |
| G          | integer | —       | 0–255                                          |
| B          | integer | —       | 0–255                                          |
| hex\_color | string  | —       | Any valid hex color (e.g., `ff0000`, `ffffff`) |

With no arguments, background manipulation is disabled.

**Examples:**

```
# White background (RGB)
bg:255:255:255

# White background (hex)
bg:ffffff

# Red background
bg:ff0000

# Light gray background
bg:f5f5f5
```

**Rewrite rule example — PNG to JPEG with white background:**

Regex: `^/jpg/(.*\.png)` Target: `/_sx/img/_/bg:ffffff/f:jpg/q:85/plain/$1`

***

### Padding

```
pd:%top:%right:%bottom:%left
```

Adds padding around the image, filled with the [background](#background) color. Uses CSS-style shorthand. Padding is applied **after** all other transformations (except watermarking) and increases the final image dimensions.

| Parameter | Type    | Default | Allowed Values                    |
| --------- | ------- | ------- | --------------------------------- |
| top       | integer | `0`     | Any non-negative integer (pixels) |
| right     | integer | `0`     | Any non-negative integer (pixels) |
| bottom    | integer | `0`     | Any non-negative integer (pixels) |
| left      | integer | `0`     | Any non-negative integer (pixels) |

#### Shorthand behavior

| Format           | Meaning                                      |
| ---------------- | -------------------------------------------- |
| `pd:10`          | 10px on all sides                            |
| `pd:10:20`       | 10px top/bottom, 20px left/right             |
| `pd:10:20:30`    | 10px top, 20px left/right, 30px bottom       |
| `pd:10:20:30:40` | 10px top, 20px right, 30px bottom, 40px left |

{% hint style="info" %}
**Note:** Padding enlarges the final image beyond the requested dimensions. If you resize to 100×200 and apply `pd:10`, the result will be 120×220 pixels.
{% endhint %}

{% hint style="info" %}
**Note:** Padding values are affected by the [DPR](https://docs.smoxy.eu/en/resizing-and-cropping#dpr-device-pixel-ratio) setting and will be scaled accordingly.
{% endhint %}

**Examples:**

```
# 10px on all sides with white background
bg:ffffff/pd:10

# 20px top/bottom, 40px left/right
pd:20:40

# Asymmetric padding
pd:10:20:30:40
```

**Rewrite rule example — product images with consistent padding:**

Regex: `^/product/(\d+)x(\d+)/(.*)` Target: `/_sx/img/_/rs:fit:$1:$2/bg:ffffff/pd:10/q:85/plain/$3`

This ensures all product images have the same dimensions with a white border, which is useful for grid layouts.
