def METHOD_NAME(self):
    t = self._to_qgraphicstextitem()
    rect = t.boundingRect()
    height = int(rect.height())
    width = int(rect.width())
    pixmap = QPixmap(width, height)
    pixmap.fill(Qt.transparent)
    painter = QPainter(pixmap)
    painter.setPen(Qt.red)
    if self.center and self.html:
        painter.drawPoint(width // 2, 0)
        painter.drawPoint(width // 2, height - 1)
    else:
        painter.drawPoint(0, 0)
        painter.drawPoint(0, height - 1)
    t.paint(painter, QStyleOptionGraphicsItem(), None)
    painter.end()
    return pixmap.toImage()