Esempio n. 1
0
def multiplexImage_WQR(to, img, qr_data):
    misc.log_t("Multiplex","enter")

    x_offset = 0 # placeholder? not really used
    spaceY = 0 # placeholder? not really used

    (w , h) = paper_size
    (ww , hh) = misc.gSize(img)

    #totalYSpace = h / 10
    #yHl = totalYSpace - 178
    #yH2 = (totalYSpace * 5) + 3

    yH1 = 0
    yH2 = h / 2

    x1Pos = (w / 4) - (ww / 2) # not used yet
    x2Pos = 0

    if(not multiplex_new):
        x2Pos = x_offset + ww # + 1
    else:
        x2Pos = ((w / 4) * 3) - (ww / 2) #x_offset + w - ww

    to.paste(img, (x1Pos , yH1))
    to.paste(img, (x2Pos  , yH1))

    to.paste(img, (x1Pos ,yH2))
    to.paste(img, (x2Pos  ,yH2))

    # paste generated QR
    qr_img = qrcode.make(qr_data).resize( (qr_size, qr_size) , Image.ANTIALIAS)

    qr_x_offset = -20 # -20
    qr_y_offset = -15

    qr_w,qr_h = qr_img.size
    to.paste(qr_img,(x2Pos - qr_w + qr_x_offset ,yH2 - qr_h  + qr_y_offset))
    to.paste(qr_img,(x2Pos - qr_w + qr_x_offset,h - qr_h  + qr_y_offset))

    to.paste(qr_img,(w - qr_w + qr_x_offset,yH2 - qr_h  + qr_y_offset))
    to.paste(qr_img,(w - qr_w + qr_x_offset,h - qr_h  + qr_y_offset))

    misc.log_t("Multiplex","exit")
    return to
Esempio n. 2
0
def multiplexImage(to, img):
    print "multiplexImage..."

    (w , h) = size
    (ww , hh) = misc.gSize(img)

    totalYSpace = h / 10
    yHl = totalYSpace - 178
    yH2 = (totalYSpace * 5) + 3

    x2Pos = spaceX + space + ww + 1

    to.paste(img,(spaceX ,yHl))
    to.paste(img,(x2Pos  ,yHl))

    to.paste(img,(spaceX ,yH2))
    to.paste(img,(x2Pos  ,yH2))

    return to
Esempio n. 3
0
def draw(img, name, surname, tc, date, ow_name):
    #if(misc.debug):
    misc.log_t("DrawInfo","enter")

    (x,y) = misc.gSize(img)
    x1 = (x / 10) / 4
    y1 = (y / 10) * 4 + 20
    x2 = (x / 15) * 8
    y2 = (y / 10) * 9 + 20

    d = ImageDraw.Draw(img)

    d.text((x1, y1), "ICAO MRTD 9303/3 - ISO/IEC 19794-5", fill='black', font=font_small)
    d.text((x1, y1 + off_name_y), name + " " + surname, fill='black', font=font_normal)
    d.text((x1, y1 + off_id_y), "ID : TR " + tc, fill='black', font=font_normal)
    d.text((x1, y1 + off_date_y), date, fill='black', font=font_msmall)
    d.text((x1 + off_owner_x, y1 + off_owner_y), ow_name, fill='black', font=font_small)

    d.text((x2, y1), "ICAO MRTD 9303/3 - ISO/IEC 19794-5", fill='black', font=font_small)
    d.text((x2, y1 + off_name_y), name + " " + surname, fill='black', font=font_normal)
    d.text((x2, y1 + off_id_y), "ID : TR " + tc, fill='black', font=font_normal)
    d.text((x2, y1 + off_date_y), date, fill='black', font=font_msmall)
    d.text((x2 + off_owner_x, y1 + off_owner_y), ow_name, fill='black', font=font_small)

    d.text((x1, y2), "ICAO MRTD 9303/3 - ISO/IEC 19794-5", fill='black', font=font_small)
    d.text((x1, y2 + off_name_y), name + " " + surname, fill='black', font=font_normal)
    d.text((x1, y2 + off_id_y), "ID : TR " + tc, fill='black', font=font_normal)
    d.text((x1, y2 + off_date_y), date, fill='black', font=font_msmall)
    d.text((x1 + off_owner_x, y2 + off_owner_y), ow_name, fill='black', font=font_small)

    d.text((x2, y2), "ICAO MRTD 9303/3 - ISO/IEC 19794-5", fill='black', font=font_small)
    d.text((x2, y2 + off_name_y), name + " " + surname, fill='black', font=font_normal)
    d.text((x2, y2 + off_id_y), "ID : TR " + tc, fill='black', font=font_normal)
    d.text((x2, y2 + off_date_y), date, fill='black', font=font_msmall)
    d.text((x2 + off_owner_x, y2 + off_owner_y), ow_name, fill='black', font=font_small)

    #val = Image.open("val.png")
    #img.paste(val, (0, 0), val)

    misc.log_t("DrawInfo","exit")
    return img