You are here

function image_imagick_definecanvas in Imagick 7

Define the canvas of an image

Parameters

$image: An image object. The $image->resource value will be modified by this call.

$data: Array of data passed through by the form.

Return value

TRUE or FALSE, based on success.

File

effects/imagick.definecanvas.inc, line 13

Code

function image_imagick_definecanvas(stdClass $image, $color, $under, $exact_size, $exact, $relative) {
  $canvas = new Imagick();
  $color = empty($color) ? 'none' : $color;
  list($width, $height, $x, $y) = _imagick_definecanvas_get_dimensions($image->info, $exact_size, $exact, $relative);
  $canvas
    ->newImage($width, $height, new ImagickPixel($color));
  if ($under) {
    $canvas
      ->compositeImage($image->resource, imagick::COMPOSITE_DEFAULT, $x, $y);
  }
  $image->info['width'] = $width;
  $image->info['height'] = $height;
  $image->resource = $canvas;
  return $image;
}