def overlay_marks(self, img, is_cseed=False, calibration_sheet=False):
    border_color = Qt.white
    base_img = QImage(self.f_size.width(), self.f_size.height(), QImage.Format_ARGB32)
    base_img.fill(border_color)
    img = QImage(img)
    painter = QPainter()
    painter.begin(base_img)
    total_distance_h = round((base_img.width() / self.abstand_v))
    dist_v = (round(total_distance_h) / 2)
    dist_h = (round(total_distance_h) / 2)
    img = img.scaledToWidth((base_img.width() - (2 * total_distance_h)))
    painter.drawImage(total_distance_h, total_distance_h, img)
    pen = QPen(Qt.black, 2)
    painter.setPen(pen)
    painter.drawLine(0, total_distance_h, base_img.width(), total_distance_h)
    painter.drawLine(0, (base_img.height() - total_distance_h), base_img.width(), (base_img.height() - total_distance_h))
    painter.drawLine(total_distance_h, 0, total_distance_h, base_img.height())
    painter.drawLine((base_img.width() - total_distance_h), 0, (base_img.width() - total_distance_h), base_img.height())
    border_thick = 6
    Rpath = QPainterPath()
    Rpath.addRect(QRectF((total_distance_h + (border_thick / 2)), (total_distance_h + (border_thick / 2)), ((base_img.width() - (total_distance_h * 2)) - (border_thick - 1)), ((base_img.height() - (total_distance_h * 2)) - (border_thick - 1))))
    pen = QPen(Qt.black, border_thick)
    pen.setJoinStyle(Qt.MiterJoin)
    painter.setPen(pen)
    painter.drawPath(Rpath)
    Bpath = QPainterPath()
    Bpath.addRect(QRectF(total_distance_h, total_distance_h, (base_img.width() - (total_distance_h * 2)), (base_img.height() - (total_distance_h * 2))))
    pen = QPen(Qt.black, 1)
    painter.setPen(pen)
    painter.drawPath(Bpath)
    pen = QPen(Qt.black, 1)
    painter.setPen(pen)
    painter.drawLine(0, (base_img.height() / 2), total_distance_h, (base_img.height() / 2))
    painter.drawLine((base_img.width() / 2), 0, (base_img.width() / 2), total_distance_h)
    painter.drawLine((base_img.width() - total_distance_h), (base_img.height() / 2), base_img.width(), (base_img.height() / 2))
    painter.drawLine((base_img.width() / 2), base_img.height(), (base_img.width() / 2), (base_img.height() - total_distance_h))
    f_size = 37
    QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'DejaVuSansMono-Bold.ttf'))
    font = QFont('DejaVu Sans Mono', (f_size - 11), QFont.Bold)
    font.setPixelSize(35)
    painter.setFont(font)
    if (not calibration_sheet):
        if is_cseed:
            painter.setPen(QPen(Qt.black, 1, Qt.DashDotDotLine))
            painter.drawLine(0, dist_v, base_img.width(), dist_v)
            painter.drawLine(dist_h, 0, dist_h, base_img.height())
            painter.drawLine(0, (base_img.height() - dist_v), base_img.width(), (base_img.height() - dist_v))
            painter.drawLine((base_img.width() - dist_h), 0, (base_img.width() - dist_h), base_img.height())
            painter.drawImage((total_distance_h + 11), (total_distance_h + 11), QImage(icon_path('electrumb.png')).scaledToWidth((2.1 * total_distance_h), Qt.SmoothTransformation))
            painter.setPen(QPen(Qt.white, (border_thick * 8)))
            painter.drawLine(((((base_img.width() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), (((((base_img.width() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2) - 77), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2))
            painter.setPen(QColor(0, 0, 0, 255))
            painter.drawText(QRect(0, (base_img.height() - 107), (((base_img.width() - total_distance_h) - border_thick) - 11), ((base_img.height() - total_distance_h) - border_thick)), Qt.AlignRight, ((self.versioned_seed.version + '_') + self.versioned_seed.checksum))
            painter.end()
        else:
            painter.setPen(QPen(border_color, 17))
            painter.drawLine(0, dist_v, base_img.width(), dist_v)
            painter.drawLine(dist_h, 0, dist_h, base_img.height())
            painter.drawLine(0, (base_img.height() - dist_v), base_img.width(), (base_img.height() - dist_v))
            painter.drawLine((base_img.width() - dist_h), 0, (base_img.width() - dist_h), base_img.height())
            painter.setPen(QPen(Qt.black, 2))
            painter.drawLine(0, dist_v, base_img.width(), dist_v)
            painter.drawLine(dist_h, 0, dist_h, base_img.height())
            painter.drawLine(0, (base_img.height() - dist_v), base_img.width(), (base_img.height() - dist_v))
            painter.drawLine((base_img.width() - dist_h), 0, (base_img.width() - dist_h), base_img.height())
            logo = QImage(icon_path('revealer_c.png')).scaledToWidth((1.3 * total_distance_h))
            painter.drawImage((total_distance_h + border_thick), (total_distance_h + border_thick), logo, Qt.SmoothTransformation)
            painter.setPen(QPen(Qt.black, border_thick))
            painter.drawLine((total_distance_h + border_thick), ((total_distance_h + logo.height()) + (3 * (border_thick / 2))), ((total_distance_h + logo.width()) + border_thick), ((total_distance_h + logo.height()) + (3 * (border_thick / 2))))
            painter.drawLine(((logo.width() + total_distance_h) + (3 * (border_thick / 2))), (total_distance_h + border_thick), ((total_distance_h + logo.width()) + (3 * (border_thick / 2))), ((total_distance_h + logo.height()) + border_thick))
            qr_size = 179
            painter.drawLine(((((base_img.width() - total_distance_h) - (border_thick / 2)) - 2) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 2), (((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - ((border_thick * 8) / 2)) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 2))
            painter.drawLine((((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - ((border_thick * 8) / 2)) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 2), (((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - ((border_thick * 8) / 2)) - qr_size), (((base_img.height() - total_distance_h) - (border_thick / 2)) - 2))
            painter.setPen(QPen(Qt.white, (border_thick * 8)))
            painter.drawLine(((((base_img.width() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), ((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - qr_size), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2))
            painter.setPen(QColor(0, 0, 0, 255))
            painter.drawText(QRect((((base_img.width() / 2) + 21) - qr_size), (base_img.height() - 107), (((base_img.width() - total_distance_h) - border_thick) - 93), ((base_img.height() - total_distance_h) - border_thick)), Qt.AlignLeft, self.versioned_seed.get_ui_string_version_plus_seed())
            painter.drawText(QRect(0, (base_img.height() - 107), ((((base_img.width() - total_distance_h) - border_thick) - 3) - qr_size), ((base_img.height() - total_distance_h) - border_thick)), Qt.AlignRight, self.versioned_seed.checksum)
            qr_qt = self.paintQR((self.versioned_seed.get_ui_string_version_plus_seed() + self.versioned_seed.checksum))
            target = QRectF(((base_img.width() - 65) - qr_size), ((base_img.height() - 65) - qr_size), qr_size, qr_size)
            painter.drawImage(target, qr_qt)
            painter.setPen(QPen(Qt.black, 4))
            painter.drawLine(((base_img.width() - 65) - qr_size), ((base_img.height() - 65) - qr_size), ((base_img.width() - 65) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 4))
            painter.drawLine(((base_img.width() - 65) - qr_size), ((base_img.height() - 65) - qr_size), (base_img.width() - 65), ((base_img.height() - 65) - qr_size))
            painter.end()
    else:
        painter.end()
        cal_img = QImage((self.f_size.width() + 100), (self.f_size.height() + 100), QImage.Format_ARGB32)
        cal_img.fill(Qt.white)
        cal_painter = QPainter()
        cal_painter.begin(cal_img)
        cal_painter.drawImage(0, 0, base_img)
        cal_painter.setPen(QPen(Qt.black, 1, Qt.DashDotDotLine))
        cal_painter.drawLine(0, dist_v, base_img.width(), dist_v)
        cal_painter.drawLine(dist_h, 0, dist_h, base_img.height())
        pen = QPen(Qt.black, 2, Qt.DashDotDotLine)
        cal_painter.setPen(pen)
        n = 15
        cal_painter.setFont(QFont('DejaVu Sans Mono', 21, QFont.Bold))
        for x in range((- n), n):
            cal_painter.drawLine(((((base_img.width() / (n * 2)) * x) + (base_img.width() / 2)) - 13), (((x + 2) + base_img.height()) - dist_v), ((((base_img.width() / (n * 2)) * x) + (base_img.width() / 2)) + 13), (((x + 2) + base_img.height()) - dist_v))
            num_pos = 9
            if (x > 9):
                num_pos = 17
            if (x < 0):
                num_pos = 20
            if (x < (- 9)):
                num_pos = 27
            cal_painter.drawText(((((base_img.width() / (n * 2)) * x) + (base_img.width() / 2)) - num_pos), ((50 + base_img.height()) - dist_v), str(x))
            cal_painter.drawLine(((x + 2) + (base_img.width() - dist_h)), (((((base_img.height() / (2 * n)) * x) + (base_img.height() / n)) + (base_img.height() / 2)) - 13), ((x + 2) + (base_img.width() - dist_h)), (((((base_img.height() / (2 * n)) * x) + (base_img.height() / n)) + (base_img.height() / 2)) + 13))
            cal_painter.drawText((30 + (base_img.width() - dist_h)), ((((base_img.height() / (2 * n)) * x) + (base_img.height() / 2)) + 13), str(x))
        cal_painter.end()
        base_img = cal_img
    return base_img
def overlay_marks(self, img, is_cseed=False, calibration_sheet=False):
    border_color = Qt.white
    base_img = QImage(self.f_size.width(), self.f_size.height(), QImage.Format_ARGB32)
    base_img.fill(border_color)
    img = QImage(img)
    painter = QPainter()
    painter.begin(base_img)
    total_distance_h = round((base_img.width() / self.abstand_v))
    dist_v = (round(total_distance_h) / 2)
    dist_h = (round(total_distance_h) / 2)
    img = img.scaledToWidth((base_img.width() - (2 * total_distance_h)))
    painter.drawImage(total_distance_h, total_distance_h, img)
    pen = QPen(Qt.black, 2)
    painter.setPen(pen)
    painter.drawLine(0, total_distance_h, base_img.width(), total_distance_h)
    painter.drawLine(0, (base_img.height() - total_distance_h), base_img.width(), (base_img.height() - total_distance_h))
    painter.drawLine(total_distance_h, 0, total_distance_h, base_img.height())
    painter.drawLine((base_img.width() - total_distance_h), 0, (base_img.width() - total_distance_h), base_img.height())
    border_thick = 6
    Rpath = QPainterPath()
    Rpath.addRect(QRectF((total_distance_h + (border_thick / 2)), (total_distance_h + (border_thick / 2)), ((base_img.width() - (total_distance_h * 2)) - (border_thick - 1)), ((base_img.height() - (total_distance_h * 2)) - (border_thick - 1))))
    pen = QPen(Qt.black, border_thick)
    pen.setJoinStyle(Qt.MiterJoin)
    painter.setPen(pen)
    painter.drawPath(Rpath)
    Bpath = QPainterPath()
    Bpath.addRect(QRectF(total_distance_h, total_distance_h, (base_img.width() - (total_distance_h * 2)), (base_img.height() - (total_distance_h * 2))))
    pen = QPen(Qt.black, 1)
    painter.setPen(pen)
    painter.drawPath(Bpath)
    pen = QPen(Qt.black, 1)
    painter.setPen(pen)
    painter.drawLine(0, (base_img.height() / 2), total_distance_h, (base_img.height() / 2))
    painter.drawLine((base_img.width() / 2), 0, (base_img.width() / 2), total_distance_h)
    painter.drawLine((base_img.width() - total_distance_h), (base_img.height() / 2), base_img.width(), (base_img.height() / 2))
    painter.drawLine((base_img.width() / 2), base_img.height(), (base_img.width() / 2), (base_img.height() - total_distance_h))
    f_size = 37
    QFontDatabase.addApplicationFont(os.path.join(os.path.dirname(__file__), 'DejaVuSansMono-Bold.ttf'))
    font = QFont('DejaVu Sans Mono', (f_size - 11), QFont.Bold)
    font.setPixelSize(35)
    painter.setFont(font)
    if (not calibration_sheet):
        if is_cseed:
            painter.setPen(QPen(Qt.black, 1, Qt.DashDotDotLine))
            painter.drawLine(0, dist_v, base_img.width(), dist_v)
            painter.drawLine(dist_h, 0, dist_h, base_img.height())
            painter.drawLine(0, (base_img.height() - dist_v), base_img.width(), (base_img.height() - dist_v))
            painter.drawLine((base_img.width() - dist_h), 0, (base_img.width() - dist_h), base_img.height())
            painter.drawImage((total_distance_h + 11), (total_distance_h + 11), QImage(icon_path('electrumb.png')).scaledToWidth((2.1 * total_distance_h), Qt.SmoothTransformation))
            painter.setPen(QPen(Qt.white, (border_thick * 8)))
            painter.drawLine(((((base_img.width() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), (((((base_img.width() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2) - 77), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2))
            painter.setPen(QColor(0, 0, 0, 255))
            painter.drawText(QRect(0, (base_img.height() - 107), (((base_img.width() - total_distance_h) - border_thick) - 11), ((base_img.height() - total_distance_h) - border_thick)), Qt.AlignRight, ((self.versioned_seed.version + '_') + self.versioned_seed.checksum))
            painter.end()
        else:
            painter.setPen(QPen(border_color, 17))
            painter.drawLine(0, dist_v, base_img.width(), dist_v)
            painter.drawLine(dist_h, 0, dist_h, base_img.height())
            painter.drawLine(0, (base_img.height() - dist_v), base_img.width(), (base_img.height() - dist_v))
            painter.drawLine((base_img.width() - dist_h), 0, (base_img.width() - dist_h), base_img.height())
            painter.setPen(QPen(Qt.black, 2))
            painter.drawLine(0, dist_v, base_img.width(), dist_v)
            painter.drawLine(dist_h, 0, dist_h, base_img.height())
            painter.drawLine(0, (base_img.height() - dist_v), base_img.width(), (base_img.height() - dist_v))
            painter.drawLine((base_img.width() - dist_h), 0, (base_img.width() - dist_h), base_img.height())
            logo = QImage(icon_path('revealer_c.png')).scaledToWidth((1.3 * total_distance_h))
            painter.drawImage((total_distance_h + border_thick), (total_distance_h + border_thick), logo, Qt.SmoothTransformation)
            painter.setPen(QPen(Qt.black, border_thick))
            painter.drawLine((total_distance_h + border_thick), ((total_distance_h + logo.height()) + (3 * (border_thick / 2))), ((total_distance_h + logo.width()) + border_thick), ((total_distance_h + logo.height()) + (3 * (border_thick / 2))))
            painter.drawLine(((logo.width() + total_distance_h) + (3 * (border_thick / 2))), (total_distance_h + border_thick), ((total_distance_h + logo.width()) + (3 * (border_thick / 2))), ((total_distance_h + logo.height()) + border_thick))
            qr_size = 179
            painter.drawLine(((((base_img.width() - total_distance_h) - (border_thick / 2)) - 2) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 2), (((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - ((border_thick * 8) / 2)) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 2))
            painter.drawLine((((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - ((border_thick * 8) / 2)) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 2), (((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - ((border_thick * 8) / 2)) - qr_size), (((base_img.height() - total_distance_h) - (border_thick / 2)) - 2))
            painter.setPen(QPen(Qt.white, (border_thick * 8)))
            painter.drawLine(((((base_img.width() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2), ((((base_img.width() / 2) + (total_distance_h / 2)) - border_thick) - qr_size), ((((base_img.height() - total_distance_h) - ((border_thick * 8) / 2)) - (border_thick / 2)) - 2))
            painter.setPen(QColor(0, 0, 0, 255))
            painter.drawText(QRect((((base_img.width() / 2) + 21) - qr_size), (base_img.height() - 107), (((base_img.width() - total_distance_h) - border_thick) - 93), ((base_img.height() - total_distance_h) - border_thick)), Qt.AlignLeft, self.versioned_seed.get_ui_string_version_plus_seed())
            painter.drawText(QRect(0, (base_img.height() - 107), ((((base_img.width() - total_distance_h) - border_thick) - 3) - qr_size), ((base_img.height() - total_distance_h) - border_thick)), Qt.AlignRight, self.versioned_seed.checksum)
            qr_qt = self.paintQR((self.versioned_seed.get_ui_string_version_plus_seed() + self.versioned_seed.checksum))
            target = QRectF(((base_img.width() - 65) - qr_size), ((base_img.height() - 65) - qr_size), qr_size, qr_size)
            painter.drawImage(target, qr_qt)
            painter.setPen(QPen(Qt.black, 4))
            painter.drawLine(((base_img.width() - 65) - qr_size), ((base_img.height() - 65) - qr_size), ((base_img.width() - 65) - qr_size), ((((base_img.height() - total_distance_h) - (border_thick * 8)) - (border_thick / 2)) - 4))
            painter.drawLine(((base_img.width() - 65) - qr_size), ((base_img.height() - 65) - qr_size), (base_img.width() - 65), ((base_img.height() - 65) - qr_size))
            painter.end()
    else:
        painter.end()
        cal_img = QImage((self.f_size.width() + 100), (self.f_size.height() + 100), QImage.Format_ARGB32)
        cal_img.fill(Qt.white)
        cal_painter = QPainter()
        cal_painter.begin(cal_img)
        cal_painter.drawImage(0, 0, base_img)
        cal_painter.setPen(QPen(Qt.black, 1, Qt.DashDotDotLine))
        cal_painter.drawLine(0, dist_v, base_img.width(), dist_v)
        cal_painter.drawLine(dist_h, 0, dist_h, base_img.height())
        pen = QPen(Qt.black, 2, Qt.DashDotDotLine)
        cal_painter.setPen(pen)
        n = 15
        cal_painter.setFont(QFont('DejaVu Sans Mono', 21, QFont.Bold))
        for x in range((- n), n):
            cal_painter.drawLine(((((base_img.width() / (n * 2)) * x) + (base_img.width() / 2)) - 13), (((x + 2) + base_img.height()) - dist_v), ((((base_img.width() / (n * 2)) * x) + (base_img.width() / 2)) + 13), (((x + 2) + base_img.height()) - dist_v))
            num_pos = 9
            if (x > 9):
                num_pos = 17
            if (x < 0):
                num_pos = 20
            if (x < (- 9)):
                num_pos = 27
            cal_painter.drawText(((((base_img.width() / (n * 2)) * x) + (base_img.width() / 2)) - num_pos), ((50 + base_img.height()) - dist_v), str(x))
            cal_painter.drawLine(((x + 2) + (base_img.width() - dist_h)), (((((base_img.height() / (2 * n)) * x) + (base_img.height() / n)) + (base_img.height() / 2)) - 13), ((x + 2) + (base_img.width() - dist_h)), (((((base_img.height() / (2 * n)) * x) + (base_img.height() / n)) + (base_img.height() / 2)) + 13))
            cal_painter.drawText((30 + (base_img.width() - dist_h)), ((((base_img.height() / (2 * n)) * x) + (base_img.height() / 2)) + 13), str(x))
        cal_painter.end()
        base_img = cal_img
    return base_img