You are here

protected function Opacity::process in Imagick 8

File

src/Plugin/ImageToolkit/Operation/imagick/Opacity.php, line 33

Class

Opacity
Defines imagick opacity operation.

Namespace

Drupal\imagick\Plugin\ImageToolkit\Operation\imagick

Code

protected function process(Imagick $resource, array $arguments) {
  $opacity = $arguments['alpha'] / 100;
  if (method_exists($resource, 'setImageOpacity')) {
    return $resource
      ->setImageOpacity($opacity);
  }
  else {
    return $resource
      ->setImageAlpha($opacity);
  }
}