protected function Convolution::execute in Image Effects 8.2
Same name in this branch
- 8.2 src/Plugin/ImageToolkit/Operation/gd/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\Convolution::execute()
- 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution::execute()
Same name and namespace in other branches
- 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution::execute()
- 8 src/Plugin/ImageToolkit/Operation/imagemagick/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution::execute()
File
- src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ Convolution.php, line 26
Class
- Convolution
- Defines ImageMagick Convolution operation.
Namespace
Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagickCode
protected function execute(array $arguments) {
if (isset($arguments['kernel']) && isset($arguments['divisor']) && isset($arguments['offset'])) {
$matrix_s = '';
foreach ($arguments['kernel'] as $vector) {
$vector = array_map(function ($e) use ($arguments) {
return $e / $arguments['divisor'] + $arguments['offset'];
}, $vector);
$matrix_s .= implode(',', $vector) . " ";
}
$matrix_s = substr($matrix_s, 0, -1);
$this
->addArgument("-morphology Convolve '3x3:{$matrix_s}'");
}
return TRUE;
}