You are here

public function ImagemagickToolkit::reset in ImageMagick 8.3

Resets all image properties and any processing argument.

This is an helper in case an image needs to be scratched or replaced.

Parameters

int $width: The image width.

int $height: The image height.

string $format: The image Imagemagick format.

See also

\Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick\CreateNew

File

src/Plugin/ImageToolkit/ImagemagickToolkit.php, line 520

Class

ImagemagickToolkit
Provides ImageMagick integration toolkit for image manipulation.

Namespace

Drupal\imagemagick\Plugin\ImageToolkit

Code

public function reset(int $width, int $height, string $format) : ImagemagickToolkit {
  $this
    ->setWidth($width)
    ->setHeight($height)
    ->setExifOrientation(NULL)
    ->setColorspace($this
    ->getExecManager()
    ->getPackage() === 'imagemagick' ? 'sRGB' : NULL)
    ->setProfiles([])
    ->setFrames(1);
  $this
    ->arguments()
    ->setSourceFormat($format)
    ->setSourceLocalPath('')
    ->reset();
  return $this;
}