Colorshift.php in Imagick 8
File
src/Plugin/ImageToolkit/Operation/imagick/Colorshift.php
View source
<?php
namespace Drupal\imagick\Plugin\ImageToolkit\Operation\imagick;
use Imagick;
use ImagickPixel;
class Colorshift extends ImagickOperationBase {
protected function arguments() {
return [
'HEX' => [
'description' => 'The color used to shift.',
],
];
}
protected function process(Imagick $resource, array $arguments) {
$color = $arguments['HEX'];
$color = empty($color) ? 'none' : $color;
return $resource
->colorizeImage(new ImagickPixel($color), 1, true);
}
}