---
application: "Intervention Image"
version: "Version 4"
status: "stable"
---

# Image Effects

## Apply Image Effects

Learn how to apply various image effects using the Intervention Image library. Adjust brightness, contrast, and colors, convert to grayscale, add gamma correction, mirror, rotate, blur, sharpen, invert colors, pixelate, and reduce colors.


## Brightness, Contrast & Colors

### Change the Image Brightness

> public Image::brightness(int $level): ImageInterface

Change the brightness of the current image by a given level. Use values between `-100` for minimum brightness `0` for no change and `+100` for maximum brightness.

#### Parameters

| Name | Type | Description |
| - | - | - |
| level | integer | Level of brightness change  |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read an image
$image = $manager->decode('images/example.png');

// increase brightness
$image = $image->brightness(35);
```


### Change the Image Contrast

> public Image::contrast(int $level): ImageInterface

Change the contrast of the current image by a given level. Use values between `-100` for minimum contrast `0` for no change and `+100` for maximum contrast.

#### Parameters

| Name | Type | Description |
| - | - | - |
| level | integer | Level of contrast change |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read an image
$image = $manager->decode('images/example.png');

// decrease the contrast
$image = $image->contrast(-10);
```

### Gamma Correction

> public Image::gamma(float $gamma): ImageInterface

Apply a gamma correction operation to the current image.

#### Parameters

| Name | Type | Description |
| - | - | - |
| gamma | float | Gamma correction value |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read an image
$image = $manager->decode('images/example.jpg');

// apply gamma correction
$image = $image->gamma(1.7);
```

### Color Correction

> public Image::colorize(int $red = 0, int $green = 0, int $blue = 0): ImageInterface

Change the intensity level of the given red, green and blue color values.
The input values are normalized so you need to include parameters from `100` for
maximum color intensity to `0` for no change and `-100` to remove all the specific
color from the image.

#### Parameters

| Name | Type | Description |
| - | - | - |
| red | int | Intensity correction of all red colors in image |
| green | int | Intensity correction of all green colors in image |
| blue | int | Intensity correction of all blue colors in image |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read an image
$image = $manager->decode('images/example.jpg');

// change colors to a blue & green tone
$image = $image->colorize(blue: 15, green: 10);
```

### Convert image to a grayscale version

> public Image::grayscale(): ImageInterface

Converts the current image to a grayscale version.

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read a colored image
$image = $manager->decode('images/example.jpg');

// turn image into a grayscale version
$image = $image->grayscale();
```



## Various Effects

### Mirror Images

> public Image::flip(Direction $direction = Direction::HORIZONTAL): ImageInterface

Mirror the current image either horizontally or vertically by passing the
direction. In the horizontal direction the left and right of the image is
swapped, for vertical mirror direction the top and bottom is swapped.

By default the methods mirrors horizontally.

#### Parameters

| Name | Type | Description |
| - | - | - |
| direction | Direction | The direction the image will be mirrored. |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read an image
$image = $manager->decode('images/example.png');

// mirror image vertically
$image = $image->flip(Direction::VERTICAL);
```

### Image Rotation

> public Image::rotate(float $angle, null|string|ColorInterface $background = null): ImageInterface

Rotate the current image clockwise by the specified angle. Optionally,
specify a background color to fill the newly created uncovered areas after the
rotation. By default the currently configured background color is used.

#### Parameters

| Name | Type | Description |
| - | - | - |
| angle | float | The rotation angle in degrees to rotate the image clockwise |
| background | null, string or ColorInterface | A color to fill the newly created areas after rotation |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// read an image
$image = $manager->decode('images/example.png');

// rotate image 45 degrees counter-clockwise 
$image = $image->rotate(-45);
```


### Image Orientation According to Exif Data

> public Image::orient(): ImageInterface

This method uses Exif data to automatically orient images correctly. **This
rotation is done automatically by default.** So you don't need to call this
method unless you have [disabled the auto orientation in the ImageManager
configuration](https://image.intervention.io/v4/basics/configuration-drivers.md).

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance without auto exif orientation
$manager = ImageManager::usingDriver(Driver::class, autoOrientation: false);

// read the image
$image = $manager->decode('images/example.jpg');

// orient image according to exif data
$image = $image->orient();
```







### Blur Effect

> public Image::blur(int $level = 5): ImageInterface

Applies a gaussian blur effect to the current image. Use the optional `level` argument to specify the strength of the effect with values between `0` and `100`.

**With the GD driver this method is performance intensive for larger blur levels. Use with caution.**

#### Parameters

| Name | Type | Description |
| - | - | - |
| level | integer | Effect strength value (0 - 100)  |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// reading an image
$image = $manager->decode('images/example.png');

// apply blur effect
$image = $image->blur(3);
```


### Sharpening Effect

> public Image::sharpen(int $level = 10): ImageInterface

Sharpen the current image instance by an optional `level`.

#### Parameters

| Name | Type | Description |
| - | - | - |
| level | integer | The level of the sharpening strength. (0 - 100)  |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// reading an image
$image = $manager->decode('images/example.png');

// apply sharpening effect
$image = $image->sharpen(3);
```


### Invert Colors

> public Image::invert(): ImageInterface

Invert all colors in the current image.

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// reading an image
$image = $manager->decode('images/example.png');

// invert colors
$image = $image->invert();
```


### Pixelation Effect

> public Image::pixelate(int $size): ImageInterface

Applies a pixelation effect to the current image with a given pixel size.

#### Parameters

| Name | Type | Description |
| - | - | - |
| size | integer | Size of the pixels. |

#### Example

```php
use Intervention\Image\ImageManager;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(new Driver());

// reading an image
$image = $manager->decode('images/example.png');

// apply the pixelation effect
$image = $image->pixelate(12);
```

### Reduce Colors

> public Image::reduceColors(int $limit, null|string|ColorInterface $background = null): ImageInterface

Apply color quantization to the current image by reducing the number of
distinct colors in the current image to the given limit. The number of colors
is reduced in a way that the new image is as visually similar as possible.

With the GD driver (semi-)transparent colors that lose their transparency as a
result of the reduction process are blended against the optional given
background color. By default the configured background color is used here.

#### Parameters

| Name | Type | Description |
| - | - | - |
| limit | integer | Allowed number of distinct colors |
| background | null, string or ColorInterface | Color formerly semi-transparent colors are blended against. |

#### Example

```php
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

// create new manager instance with desired driver
$manager = ImageManager::usingDriver(Driver::class);

// reading an image
$image = $manager->decode('images/example.png');

// quantize colors to a maximum of 16
$image = $image->reduceColors(16);
```

---

## Become a Sponsor

### Intervention Image needs your help to keep the project going

Intervention Image is non-commercial, open source licensed and completely free to use. The considerable
effort required to maintain and develop the software is only possible with the financial support
of sponsors. There are two ways in which you can support this project.

- Support via [GitHub Sponsors](https://github.com/sponsors/Intervention)
- Support via [Ko-Fi](https://ko-fi.com/interventionphp)