PythonAPI/jaxinye.py
def crop(path, input, height, width, k, page, area=(0,0,255,255)):
    '''
    Crop input image into pieces of size specified as height X witdth
    '''
    im = Image.open(input)
    imgwidth, imgheight = im.size
    print(im.size)
    for i in range(0,imgheight,height):
        for j in range(0,imgwidth,width):
            box = (j, i, j+width, i+height)
            a = im.crop(box)
            a.save(os.path.join(path,"IMG-%s.png" % str(k).zfill(2)))
            try:
                o = a.crop(area)
                o.save(os.path.join(path,"PNG","%s" % page,"IMG-%s.png" % k))
            except:
                pass
            k +=1

    Crop input image into pieces of size specified as height X witdth
    
Crop input image into pieces of size specified as height X witdth
Crop input image into pieces of size specified as height X witdth
def crop(path, input, height, width, k, page, area=(0,0,255,255)):
    im = Image.open(input)
    imgwidth, imgheight = im.size
    print(im.size)
    for i in range(0,imgheight,height):
        for j in range(0,imgwidth,width):
            box = (j, i, j+width, i+height)
            a = im.crop(box)
            a.save(os.path.join(path,"IMG-%s.png" % str(k).zfill(2)))
            try:
                o = a.crop(area)
                o.save(os.path.join(path,"PNG","%s" % page,"IMG-%s.png" % k))
            except:
                pass
            k +=1
def crop ( path , input , height , width , k , page , area = ( 0 , 0 , 255 , 255 ) ) : im = Image . open ( input ) imgwidth , imgheight = im . size print ( im . size ) for i in range ( 0 , imgheight , height ) : for j in range ( 0 , imgwidth , width ) : box = ( j , i , j + width , i + height ) a = im . crop ( box ) a . save ( os . path . join ( path , "IMG-%s.png" % str ( k ) . zfill ( 2 ) ) ) try : o = a . crop ( area ) o . save ( os . path . join ( path , "PNG" , "%s" % page , "IMG-%s.png" % k ) ) except : pass k += 1
Crop input image into pieces of size specified as height X witdth
Crop input image into pieces of size specified as height X witdth
'''
    Crop input image into pieces of size specified as height X witdth
    '''
path
input
height
width
k
page
area