protected function convertResource($convertTo)
    {
        $this->tmpImage[] = $tmpImage = tempnam(sys_get_temp_dir(), 'picture');

        if($this->isGd())
        {
            imagepng($this->resource, $tmpImage, 0);
        }
        else
        {
            $this->resource->writeImage($tmpImage);
        }

        if($convertTo === $this::WORKER_GD)
        {
            return $this->getGdResource($tmpImage);
        }
        else
        {
            return $this->createImagick($tmpImage);
        }
    }