Fork me on GitHub

Image Formats

The readable image formats depend on the choosen driver (GD or Imagick) and your local configuration. By default Intervention Image currently supports the following major formats.

GD Read/Write Read/Write Read/Write - - - -
Imagick Read/Write Read/Write Read/Write Read/Write Read/Write Read/Write Read/Write

See documentation of make method to see how to read image formats from different sources, respectively encode and save to learn how to output images.

Color Formats

Intervention Image supports four ways to define colors for its methods.

Integer Format

By default the pickColor method returns the RGB value as integer. You can also pass a color in this format to all other methods.


// pick color and fill image
$color = Image::make('public/foo.jpg')->pickColor(10, 10);

// pass colors of the GD Library
$im = imagecreatefrompng('public/foo.jpg');
$rgb = imagecolorat($im, 10, 15);

Array Format

Pass the RGB integers of a color as a PHP array with or without an alpha value between 1 (opaque) and 0 (full transparency).


// color in array format
$img->fill(array(255, 0, 0));

// color in array format with alpha value
$img->fill(array(255, 255, 255, 0.5));

Hexadecimal Format

You can pass colors as a hex triplet used normally in HTML and CSS. It's possible to use six-digit format as well as the shorthand form.


// shorthand hex color

// six-digit hex color

// works without prefix

RGB & RGBA string format

RGB string values in functional notations are also supported. If you want to include an alpha value use the RGBA format like in the following example.


// rgb color value in integer range
$img->fill('rgb(255, 0, 0)');

// rgba color value with alpha
$img->fill('rgba(255, 0, 0, 1)');

// rgba color value with transparent alpha
$img->fill('rgba(0, 0, 0, 0.5)');