public function getImage($size = null)
    {
        assert('$this->image');
        if ($size === null) {
            $size = $this->maxSize;
        }
        $icon = imagecreatetruecolor($size, $size);
        $srcSize = $this->tileSize * $this->tiles;
        imagecopyresampled($icon, $this->image, 0, 0, 0, 0, $size, $size, $srcSize, $srcSize);
        return $icon;
    }