|
|
|
@ -22,21 +22,20 @@ def fill(x1,y1, x2,y2, color):
|
|
|
|
|
pxls.append([x, y, r, g, b])
|
|
|
|
|
return pxls
|
|
|
|
|
|
|
|
|
|
# draw( fill(...) )
|
|
|
|
|
def draw(pxls):
|
|
|
|
|
# draw( fill(...), limit=500, token="fdsfs" )
|
|
|
|
|
def draw(pxls, limit=300, token=None):
|
|
|
|
|
global server
|
|
|
|
|
ic(pxls)
|
|
|
|
|
|
|
|
|
|
push = [] # Push %limit% items
|
|
|
|
|
limit = 300
|
|
|
|
|
while len(pxls) > limit:
|
|
|
|
|
packs = [] # Merge elements to %limit% size list
|
|
|
|
|
for i in range(limit):
|
|
|
|
|
# Take first element
|
|
|
|
|
packs.append(pxls[0])
|
|
|
|
|
pxls.pop(0)
|
|
|
|
|
push.append({"main": pack(packs)})
|
|
|
|
|
push.append({"main": pack(pxls)}) # Pack last
|
|
|
|
|
push.append({"main": pack(packs), "token": token})
|
|
|
|
|
push.append({"main": pack(pxls), "token": token}) # Pack last
|
|
|
|
|
|
|
|
|
|
ic(push)
|
|
|
|
|
for i in tqdm(push):
|
|
|
|
@ -65,7 +64,6 @@ def ccheck(packed):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### EXAMPLE
|
|
|
|
|
# Draw random square 100x100 on 0,0
|
|
|
|
|
from random import randint as ri
|
|
|
|
@ -83,3 +81,7 @@ from im_convert import *
|
|
|
|
|
image = convert("example.png", [10,0])
|
|
|
|
|
from remove_back import *
|
|
|
|
|
draw( optimize(image, [255,255,255]) ) # Remove white background and draw
|
|
|
|
|
|
|
|
|
|
# Draw with premium-token, limit 450
|
|
|
|
|
# Token is fake, >ERROR<
|
|
|
|
|
draw( fill(758,0, 1123,198, [255,255,255]), limit=450, token="3744138bd462cd8180e4w3534rfdsw4rwert" )
|
|
|
|
|