You are here

Desaturate.php in ImageMagick 8

File

src/Plugin/ImageToolkit/Operation/imagemagick/Desaturate.php
View source
<?php

namespace Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick;


/**
 * Defines imagemagick Desaturate operation.
 *
 * @ImageToolkitOperation(
 *   id = "imagemagick_desaturate",
 *   toolkit = "imagemagick",
 *   operation = "desaturate",
 *   label = @Translation("Desaturate"),
 *   description = @Translation("Converts an image to grayscale.")
 * )
 */
class Desaturate extends ImagemagickImageToolkitOperationBase {

  /**
   * {@inheritdoc}
   */
  protected function arguments() {

    // This operation does not use any parameters.
    return [];
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(array $arguments) {
    $this
      ->getToolkit()
      ->addArgument('-colorspace GRAY');
    return TRUE;
  }

}

Classes

Namesort descending Description
Desaturate Defines imagemagick Desaturate operation.