public function flip(&$image, $mode){
        if ($mode === 'h') {
            $image->getCore()->flopImage();
        } else if ($mode === 'v') {
            $image->getCore()->flipImage();
        } else {
            throw new \Exception(sprintf('Unsupported mode "%s"', $mode));
        }
        return $this;
    }