You are here

function imageapi_imagemagick_image_imagemask in ImageCache Actions 6.2

Convert the image to PNG and apply an image-based transparency mask using ImageMagick

&$image is an array expected to contain the details of the image to be masked $mask is an array expected to contain the details of the mask image

File

canvasactions/canvasactions.inc, line 132

Code

function imageapi_imagemagick_image_imagemask(&$image, $mask = array()) {

  //TODO: ensure the original image mask is retained (may be a multi-step operation)
  $image->ops[] = "'{$mask->source}' -alpha Off -compose CopyOpacity -composite";

  // ensure the final image is a PNG due to transparency:
  $image->info['extension'] = 'png';
  $image->info['mime_type'] = 'image/png';
  return TRUE;
}