Esempio n. 1
0
def testRun(name,surname,tc,printnum,x0,y0,z0,r0):
    name = name.replace('"','')

    x1 = ast.literal_eval(x0)
    y1 = ast.literal_eval(y0)
    z1 = ast.literal_eval(z0)
    r1 = ast.literal_eval(r0)

    lImagePath = lastImage.find()
    #lImagePath = "getPicture.jpg"
    if (os.path.isfile(lImagePath)):
        print "loading... " + lImagePath
        i_base = Image.open(lImagePath)

        i_base = rotate.rotateImage(resizeZ(i_base, z1),270 - int(r1))

        i_base = cropImage(i_base, transform(i_base ,imgSize, x1, y1 -200) )

        i_base =  cropImage(resizeImage(i_base), icaoSize)

        i_out = multiplexImage( Image.new("RGB", finalPaperSize , "white") , i_base)
        out =  drawInfo.draw(i_out, name, surname, tc, misc.timeString())

        print "saving... to out\\"
        #i_out.save("out\\" + os.path.basename(lImagePath))
        i_out.save("out\\" + tc + ".jpg")
        print "printing..."
        for x in range(0,int(printnum)):
            print "Printed %d" % (x)
            jpgprinter.printImage(printerNm,i_out, "DS360 - OUT")
        return "Print Request Done"
    else:
        return "File find error... aborted"
Esempio n. 2
0
def run(name,surname,tc,printnum,x0,y0,z0):
    name = name.replace('"','')

    x1 = ast.literal_eval(x0)
    y1 = ast.literal_eval(y0)
    z1 = ast.literal_eval(z0)

    print "find last image..."
    lImagePath = lastImage.find()
    lImagePath = "test.jpg"
    print lImagePath

    if (os.path.isfile(lImagePath)):
        print "loading... " + lImagePath
        i_out = Image.new("RGB", size, "white")
        i_base = Image.open(lImagePath)

        print "adım0"
        image_resize_z = resizeZ(i_base, z1)
        image_resize_z.save("0.jpg")

        print "adım1"
        trans = transform(lastSize, x1, y1)

        print "adım2"
        image_crop = cropImage(image_resize_z, trans)
        image_crop.save("1.jpg")

        print "adım3"
        image_resize = resizeImage(rotate.rotateImage(image_crop,270))
        image_resize.save("2.jpg")

        print "adım4"
        image_zoom = resizePercent(image_resize, 130)
        image_zoom.save("3.jpg")

        print "adım5"
        imagezac = cropImage(image_zoom, lastSize)
        imagezac.save("4.jpg")

        i_out = multiplexImage(i_out, imagezac)
        out =  drawInfo.draw(i_out, name, surname, tc, misc.timeString())

        print "saving... to out\\"
        i_out.save("5.jpg")
        #i_out.save("out\\" + os.path.basename(lImagePath))
        print "printing..."
        for x in range(0,int(printnum)):
            print "Printed %d" % (x)
            #jpgprinter.printImage(printerNm,i_out, "DS360 - OUT")
        return "Print Request Done"
    else:
        return "File find error... aborted"