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

# Configuration & Drivers

## Use the ImageManager to Configure Intervention Image

Learn how to create and configure Intervention Image. Discover the image manager, driver options (GD, Imagick or libvips), and advanced settings like auto-orientation, animation decoding, and replacing background colors.


## Create a new Image Manager Instance

> public ImageManager::__construct(string|DriverInterface $driver, mixed ...$options): ImageManager

The image manager is the starting point for all operations. With this class you
determine the driver to use, the configuration options and call the methods
needed for [reading images from different sources](https://image.intervention.io/v4/basics/instantiation#reading-image-sources.md).

### Driver Selection

The driver determines which PHP image library is used under the hood.
Intervention Image is a universal API for various low-level PHP image
extensions and currently ships with two different drivers. Depending on your
PHP installation, you choose one of them.

#### Driver for GD Library

GD is bundled by default in many installations, but has the disadvantage of
lacking advanced image processing capabilities like support for different color
spaces. **GD unfortunately discards any Exif data in the encoding process**. The driver for
GD is included by default.

- `Intervention\Image\Drivers\Gd\Driver`

#### Driver for Imagick

Imagick is a PHP extension that provides bindings to the ImageMagick library,
which is a popular and powerful image processing tool. In my experience, this
extension often delivers higher quality results than GD. The driver is included
by default.

- `Intervention\Image\Drivers\Imagick\Driver`

#### Driver for libvips

libvips is a fast, low-memory image processing library that outperforms all
other PHP image processing libraries. Support for this library is available via Intervention Image's [official driver to use
Intervention Image with libvips](https://github.com/Intervention/image-driver-vips) which can be
installed additionally.

- `Intervention\Image\Drivers\Vips\Driver`

### Configuration Options

Optionally, it is possible to pass further detailed configuration parameters to
the constructor that determine the behavior of the library.

These parameters affect how the library handles the [orientation of the image
according to Exif
data](https://image.intervention.io/v4/modifying-images/effects#image-orientation-according-to-exif-data.md), whether
[animations are decoded or discarded](https://image.intervention.io/v4/modifying-images/animations.md), and what the [default background
color](https://image.intervention.io/v4/basics/colors#transparency.md) is.

#### Parameters

| Name | Type | Description |
| - | - | - |
| driver | string or DriverInterface | Image Manager driver instance or driver class name |
| autoOrientation | bool | (optional) Decides whether the image should be automatically aligned based on the Exif data. Default: `true` |
| decodeAnimation | bool | (optional) Whether a possibly animated image is decoded as such or whether the animation is discarded. Default: `true` |
| backgroundColor | mixed | (optional) The standard background color for blending operations. Default: `ffffff` |
| strip | bool | (optional) Decides whether image meta data should be removed in the encoding process. Default: `false` |

#### Example

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

// create new manager instance with desired driver and default configuration
$manager = new ImageManager(new Driver());

// alternatively create new manager instance by class name and default configuration
$manager = new ImageManager(Driver::class);

// same call with configuration options
$manager = new ImageManager(
    Driver::class,
    autoOrientation: false,
    decodeAnimation: true,
    backgroundColor: 'ff5500',
    strip: false
);
```

## Create a new Image Manager Instance with Static Helper Methods

### Static Constructor

> public static ImageManager::usingDriver(string|DriverInterface $driver, mixed ...$options): ImageManager

The static helper method acts the same way as the constructor and takes either
a class name or an instance of the driver and optionally configuration parameters.

[See possible options for configuration.](https://image.intervention.io/v4/basics/configuration-drivers#create-a-new-image-manager-instance.md)

#### Parameters

| Name | Type | Description |
| - | - | - |
| driver | string or DriverInterface | Image Manager driver instance or driver class name |
| options | mixed | Optional configuration parameters |

#### Example

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

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

// or create new manager by class name
$manager = ImageManager::usingDriver(Driver::class);

// same call with configuration options
$manager = ImageManager::usingDriver(
    Driver::class,
    autoOrientation: true,
    decodeAnimation: true,
    backgroundColor: 'ff5500',
    strip: true
);
```

Read more about the different methods of the image manager in the [instantiation section](https://image.intervention.io/v4/basics/instantiation.md)

---

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