def pixelcode_2x2(self, img):
    result = QImage((img.width() * 2), (img.height() * 2), QImage.Format_ARGB32)
    white = qRgba(255, 255, 255, 0)
    black = qRgba(0, 0, 0, 255)
    for x in range(img.width()):
        for y in range(img.height()):
            c = img.pixel(QPoint(x, y))
            colors = QColor(c).getRgbF()
            if colors[0]:
                result.setPixel(((x * 2) + 1), ((y * 2) + 1), black)
                result.setPixel((x * 2), ((y * 2) + 1), white)
                result.setPixel(((x * 2) + 1), (y * 2), white)
                result.setPixel((x * 2), (y * 2), black)
            else:
                result.setPixel(((x * 2) + 1), ((y * 2) + 1), white)
                result.setPixel((x * 2), ((y * 2) + 1), black)
                result.setPixel(((x * 2) + 1), (y * 2), black)
                result.setPixel((x * 2), (y * 2), white)
    return result
def pixelcode_2x2(self, img):
    result = QImage((img.width() * 2), (img.height() * 2), QImage.Format_ARGB32)
    white = qRgba(255, 255, 255, 0)
    black = qRgba(0, 0, 0, 255)
    for x in range(img.width()):
        for y in range(img.height()):
            c = img.pixel(QPoint(x, y))
            colors = QColor(c).getRgbF()
            if colors[0]:
                result.setPixel(((x * 2) + 1), ((y * 2) + 1), black)
                result.setPixel((x * 2), ((y * 2) + 1), white)
                result.setPixel(((x * 2) + 1), (y * 2), white)
                result.setPixel((x * 2), (y * 2), black)
            else:
                result.setPixel(((x * 2) + 1), ((y * 2) + 1), white)
                result.setPixel((x * 2), ((y * 2) + 1), black)
                result.setPixel(((x * 2) + 1), (y * 2), black)
                result.setPixel((x * 2), (y * 2), white)
    return result