def filter(img):
    img = img.convert('RGB')
    ch = random.choice([pil_filter,resize_filter,color_reduce_filter,chops_filter])
    if verbose: print(ch)
    return ch(img)

def many_filters(img):
    runs = random.choice([6,7,8,9,20])
    if verbose: print("{} filters".format(runs))
    for i in range(runs):
        img = filter(img)
    return img

if __name__=="__main__":
    if len(sys.argv) > 2:
        if sys.argv[2] == "-s":
            verbose = False
    if verbose: print("filter")
    

    img = many_filters(image_grab.get_image("art deco","pixel","glitch","brutalist","vhs","hacker","gif","cat","dog","architecture","brutalism","jazz"))
    output_path = "output.png"
    if len(sys.argv) > 1:
        output_path = sys.argv[1]


    img = img.convert('RGB')
    img = img.thumbnail((400,400), Image.ANTIALIAS)

    img.save(output_path)
示例#2
0
import os, random, image_filter, image_grab
def rand_name():
    output = ''
    for i in range(10):
        output+=str(random.randint(0,9))
    return output

image_filter.verbose=False

words = ["art deco","pixel","glitch","brutalist","vhs","hacker","gif","cat","dog","architecture","brutalism","jazz",
"vaporwave","hyperwave","aloewave","classical","aesthetics","same","nsfw","landscape","horny","breasts","naked"]

for i in range(20):
    print ("{}/20".format(i+1))
    image_filter.many_filters(image_grab.get_image(*words)).save("output/{}.png".format(rand_name()))