public function invert($vertical = false)
    {
        //Argument 1 must be a boolean
        Argument::i()->test(1, 'bool');

        //get the source width and height
        $orgWidth = imagesx($this->resource);
        $orgHeight = imagesy($this->resource);

        $invert = imagecreatetruecolor($orgWidth, $orgHeight);

        if ($vertical) {
            imagecopyresampled(
                $invert,
                $this->resource,
                0,
                0,
                0,
                $orgHeight-1,
                $orgWidth,
                $orgHeight,
                $orgWidth,
                0-$orgHeight
            );
        } else {
            imagecopyresampled(
                $invert,
                $this->resource,
                0,
                0,
                $orgWidth-1,
                0,
                $orgWidth,
                $orgHeight,
                0-$orgWidth,
                $orgHeight
            );
        }

        //destroy the original resource
        imagedestroy($this->resource);

        //assign the new resource
        $this->resource = $invert;

        return $this;
    }