public function cropImage($sourcePath, $destinationPath, CropImageDOInterface $crop)
 {
     if (!$this->filesystem->has($sourcePath)) {
         throw new NotFoundException('Can not crop. Resource is not found');
     }
     $this->createDirectory(dirname($destinationPath));
     $imagick = $this->getImagick($sourcePath);
     $imagick->cropImage($crop->getWidth(), $crop->getHeight(), $crop->getX(), $crop->getY());
     $imagick->writeImage($destinationPath);
     $imagick->clear();
     $imagick->destroy();
 }
 /**
  * @return array
  */
 public function toArray()
 {
     $data = parent::toArray();
     if ($this->crop) {
         $data['crop'] = $this->crop->toArray();
     } else {
         unset($data['crop']);
     }
     $data[self::TOKEN_DIMENSION] = '' . $this->getDimension();
     return $data;
 }