예제 #1
0
def doFilter(filter_name, pil_image, output_path):
    if filter_name == 'inkwell':
        pilgram.inkwell(pil_image).save(output_path)
    elif filter_name == 'aden':
        pilgram.aden(pil_image).save(output_path)
    elif filter_name == 'clarendon':
        pilgram.clarendon(pil_image).save(output_path)
예제 #2
0
def instagram_filter(im, filter_):
    buffer = BytesIO()
    im = Image.open(im)
    filter_ = filter_.lower()
    if filter_ == "_1977":
        pilgram._1977(im).save(buffer, format="png")
    elif filter_ == "aden":
        pilgram.aden(im).save(buffer, format="png")
    elif filter_ == "brannan":
        pilgram.brannan(im).save(buffer, format="png")
    elif filter_ == "brooklyn":
        pilgram.brooklyn(im).save(buffer, format="png")
    elif filter_ == "clarendon":
        pilgram.clarendon(im).save(buffer, format="png")
    elif filter_ == "gingham":
        pilgram.gingham(im).save(buffer, format="png")
    elif filter_ == "hudson":
        pilgram.hudson(im).save(buffer, format="png")
    elif filter_ == "inkwell":
        pilgram.inkwell(im).save(buffer, format="png")
    elif filter_ == "earlybird":
        pilgram.earlybird(im).save(buffer, format="png")
    elif filter_ == "kelvin":
        pilgram.kelvin(im).save(buffer, format="png")
    elif filter_ == "lark":
        pilgram.lark(im).save(buffer, format="png")
    elif filter_ == "lofi":
        pilgram.lofi(im).save(buffer, format="png")
    elif filter_ == "maven":
        pilgram.maven(im).save(buffer, format="png")
    elif filter_ == "mayfair":
        pilgram.mayfair(im).save(buffer, format="png")
    elif filter_ == "moon":
        pilgram.moon(im).save(buffer, format="png")
    elif filter_ == "nashville":
        pilgram.nashville(im).save(buffer, format="png")
    elif filter_ == "perpetua":
        pilgram.perpetua(im).save(buffer, format="png")
    elif filter_ == "reyes":
        pilgram.reyes(im).save(buffer, format="png")
    elif filter_ == "rise":
        pilgram.rise(im).save(buffer, format="png")
    elif filter_ == "slumber":
        pilgram.slumber(im).save(buffer, format="png")
    elif filter_ == "stinson":
        pilgram.stinson(im).save(buffer, format="png")
    elif filter_ == "toaster":
        pilgram.toaster(im).save(buffer, format="png")
    elif filter_ == "valencia":
        pilgram.valencia(im).save(buffer, format="png")
    elif filter_ == "walden":
        pilgram.walden(im).save(buffer, format="png")
    elif filter_ == "willow":
        pilgram.willow(im).save(buffer, format="png")
    elif filter_ == "xpro2":
        pilgram.xpro2(im).save(buffer, format="png")
    else:
        return "Nama Filter Belum Tersedia"
    return buffer
예제 #3
0
def doFilterPIL(filter_name, pil_image):
    if filter_name == 'inkwell':
        return pilgram.inkwell(pil_image)
    elif filter_name == 'aden':
        return pilgram.aden(pil_image)
    elif filter_name == 'clarendon':
        return pilgram.clarendon(pil_image)
 elif filter == 'aden':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.aden(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'brannan':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.brannan(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'brooklyn':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.brooklyn(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'clarendon':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.clarendon(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'earlybird':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.earlybird(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'gingham':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.gingham(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'hudson':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
     pilgram.hudson(Image.open(os.path.join(original_images_dir_path, original_image_file))).save(os.path.join(_path, original_image_file))
 elif filter == 'inkwell':
     _path = os.path.join(split_root, filter)
     os.makedirs(_path, exist_ok=True)
예제 #5
0
def test_clarendon():
    im = util.fill((32, 32), [255] * 3)
    clarendon(im)
예제 #6
0
def pilgram_clarendon(pil_image, output_path):
    pilgram.clarendon(pil_image).save(output_path)
예제 #7
0
         temp0 = rnd(1, 5)
         if temp0 == 1:
             print("Brannan filter selected.")
             image = pilgram.brannan(image)
         elif temp0 == 2:
             print("Hudson filter selected")
             image = pilgram.hudson(image)
         elif temp0 == 3:
             print("Valencia filter selected")
             image = pilgram.valencia(image)
         elif temp0 == 4:
             print("Reyes filter selected")
             image = pilgram.reyes(image)
         elif temp0 == 5:
             print("Clarendon filter selected")
             image = pilgram.clarendon(image)
     change_count = 1
 elif action == 2:
     print("Crop")
     print("0. Cancel")
     print("1. Start")
     crop_action = -1
     while crop_action != 0 and crop_action != 1:
         crop_action = input_number("Your choice: ")
     if crop_action == 0:
         print("Canceled!")
         slp(1)
         print("\n" * 30)
         continue
     elif crop_action == 1:
         startX = -1
예제 #8
0
def Clarendon(image):
    return pilgram.clarendon(image)