public function createImage()
    {
        $ini = microtime(true);

        /** Initialization */
        $this->imageAllocate();
        
        /** Text insertion */
        $text = $this->getCaptchaText();
        $fontcfg  = $this->fonts[array_rand($this->fonts)];
        $this->writeText($text, $fontcfg);

        /** Transformations */
        if (!empty($this->lineWidth)) {
            $this->writeLine();
        }
        $this->waveImage();
        if ($this->blur && function_exists('imagefilter')) {
            imagefilter($this->im, IMG_FILTER_GAUSSIAN_BLUR);
        }
        $this->reduceImage();

        if ($this->debug) {
            imagestring(
                $this->im,
                1,
                1,
                $this->height-8,
                "$text {$fontcfg['font']} ".round((microtime(true)-$ini)*1000)."ms",
                $this->GdFgColor
            );
        }

        /** Output */
        $this->writeImage();
        $this->cleanup();

        return $text;
    }