public function crop(array $rectangle) {
        $croppedImage = @imagecrop($this->resource, $rectangle);
        if($croppedImage === false) {
            $rectangleAsString = "{";
            foreach($rectangle as $key => $value) {
                $rectangleAsString .= "\"{$key}\" => {$value}, ";
            }
            $rectangleAsString = preg_replace("/, $/", "}", $rectangleAsString);
            throw new ImageException(
                "Can not crop image {$this} via rectangle {$rectangleAsString}.",
                ImageException::GenericException
            );
        }
        $this->resource = $croppedImage;
        $this->width = $rectangle["width"];
        $this->height = $rectangle["height"];
    }