---
application: "Intervention Image"
version: "Version 2"
status: "eol"
---

# Usage Overview

## Overview of the main use cases




## Basic Usage

#### Example

```php
// include composer autoload
require 'vendor/autoload.php';

// import the Intervention Image Manager Class
use Intervention\Image\ImageManager;

// create an image manager instance with favored driver
$manager = new ImageManager(['driver' => 'imagick']);

// to finally create image instances
$image = $manager->make('public/foo.jpg')->resize(300, 200);
```

You might also use the static version of ImageManager as shown in the example below.

#### Static Example

```php
// include composer autoload
require 'vendor/autoload.php';

// import the Intervention Image Manager Class
use Intervention\Image\ImageManagerStatic as Image;

// configure with favored image driver (gd by default)
Image::configure(['driver' => 'imagick']);

// and you are ready to go ...
$image = Image::make('public/foo.jpg')->resize(300, 200);
```

You can read more detailed information about [installation](https://image.intervention.io/v2/getting-started/installation.md) and [configuration](https://image.intervention.io/v2/getting-started/configuration.md).

## Reading Images

Intervention Image makes it super easy to read images. The Library takes away any annoying work, the only thing you have to do is to give a file path to the method [make()](https://image.intervention.io/v2/api/make.md).

#### Read image from file

```php
$img = Image::make('foo/bar/baz.jpg');
```

The method is highly variable. It not only reads filepaths but also the following input formats.

- Path of the image in filesystem.
- URL of an image (```allow_url_fopen``` must be enabled).
- Binary image data.
- Data-URL encoded image data.
- Base64 encoded image data.
- PHP resource of type gd. (when using GD driver)
- Imagick instance (when using Imagick driver)
- Intervention\Image\Image instance
- SplFileInfo instance (To handle Laravel file uploads via Symfony\Component\HttpFoundation\File\UploadedFile)

See more examples to initiate image instances in the [api documentation](https://image.intervention.io/v2/api/make.md).

## Creating Images

If you want to create a new empty image instance you can call the [canvas()](https://image.intervention.io/v2/api/canvas.md) method with given width and height. Optionally it's possible to define a background-color, if not passed the default the canvas background is transparent.

#### Creating new images with background color

```php
$img = Image::canvas(800, 600, '#ccc');
```

See more examples to create new image instances in the [api documentation](https://image.intervention.io/v2/api/canvas.md).

## Editing Images

After you initiated a new image instance with [make()](https://image.intervention.io/v2/api/make.md) or [canvas()](https://image.intervention.io/v2/api/canvas.md), you can use the whole palette of manipulation methods on the instance.

Usually each command returns a modified instance of Intervention\Image\Image, so you are able to chain methods.

#### Method chaining

```php
$img = Image::make('foo.jpg')->resize(320, 240)->insert('watermark.png');
```

Take a look at some of the methods in the following list.

### Resizing Images

- [resize()](https://image.intervention.io/v2/api/resize.md)
- [widen()](https://image.intervention.io/v2/api/widen.md)
- [heighten()](https://image.intervention.io/v2/api/heighten.md)
- [fit()](https://image.intervention.io/v2/api/fit.md)
- [resizeCanvas()](https://image.intervention.io/v2/api/resize-canvas.md)
- [crop()](https://image.intervention.io/v2/api/crop.md)
- [trim()](https://image.intervention.io/v2/api/trim.md)

### Adjusting Images

- [gamma()](https://image.intervention.io/v2/api/gamma.md)
- [brightness()](https://image.intervention.io/v2/api/brightness.md)
- [contrast()](https://image.intervention.io/v2/api/contrast.md)
- [colorize()](https://image.intervention.io/v2/api/colorize.md)
- [greyscale()](https://image.intervention.io/v2/api/greyscale.md)
- [invert()](https://image.intervention.io/v2/api/invert.md)
- [mask()](https://image.intervention.io/v2/api/mask.md)
- [flip()](https://image.intervention.io/v2/api/flip.md)

### Applying Effects

- [filter()](https://image.intervention.io/v2/api/filter.md)
- [pixelate()](https://image.intervention.io/v2/api/pixelate.md)
- [rotate()](https://image.intervention.io/v2/api/rotate.md)
- [blur()](https://image.intervention.io/v2/api/blur.md)

### Drawing

- [text()](https://image.intervention.io/v2/api/text.md)
- [pixel()](https://image.intervention.io/v2/api/pixel.md)
- [line()](https://image.intervention.io/v2/api/line.md)
- [rectangle()](https://image.intervention.io/v2/api/rectangle.md)
- [circle()](https://image.intervention.io/v2/api/circle.md)
- [ellipse()](https://image.intervention.io/v2/api/ellipse.md)

### Retrieving Information

- [width()](https://image.intervention.io/v2/api/width.md)
- [height()](https://image.intervention.io/v2/api/height.md)
- [mime()](https://image.intervention.io/v2/api/mime.md)
- [exif()](https://image.intervention.io/v2/api/exif.md)
- [iptc()](https://image.intervention.io/v2/api/iptc.md)


See the **api documentation** for the whole list of commands.

## Image Output

To create actually image data from an image object, you can access methods like [encode](https://image.intervention.io/v2/api/encode.md) to create encoded image data or use [save](https://image.intervention.io/v2/api/save.md) to write an image into the filesystem. It's also possible to send a HTTP [response](https://image.intervention.io/v2/api/response.md) with current image data.

#### Save an image in filesystem

```php
Image::make('foo.jpg')->resize(300, 200)->save('bar.jpg');
```

Read more about [image HTTP responses](https://image.intervention.io/v2/usage/http-response.md).

### Outputting Image data

- [encode()](https://image.intervention.io/v2/api/encode.md)
- [save()](https://image.intervention.io/v2/api/save.md)
- [response()](https://image.intervention.io/v2/api/response.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)