Skip to content
Snippets Groups Projects
Commit 0026f5bb authored by Antonio MATTAR's avatar Antonio MATTAR
Browse files

-Added the stars to the reductors // -Added the comptability of the clear cmd...

-Added the stars to the reductors // -Added the comptability of the clear cmd for Windows/Mac/Linux // -Fixed the quality of  the images generated
parent 5783d388
No related branches found
No related tags found
No related merge requests found
File deleted
File deleted
File deleted
File deleted
......@@ -94,20 +94,20 @@ space_width = 0
def get_space_wdith():
return space_width
def get_concat_h_multi_resize(im_list, resample=Image.BICUBIC):
def get_concat_h_multi_resize(im_list, resample=Image.BILINEAR):
global space_width
max_height=max(im.height for im in im_list)
min_height = min(im.height for im in im_list)
max_width = sum(im.width for im in im_list)
# max_width = sum(im.width for im in im_list)
min_width=min(im.width for im in im_list)
if space_width == 0:
space_width=(int(min_width*0.3))
else:
space_width=min(get_space_wdith(),int(min_width*0.3))
total_init_width = sum(im.width for im in im_list) + get_space_wdith() * (len(im_list) - 1)
im_list_resize = [im.resize((int(im.width * min_height / im.height), min_height), resample=resample)
for im in im_list]
total_width = sum(im.width for im in im_list_resize) + (len(im_list_resize) -1) * space_width
# im_list_resize = [im.resize((int(im.width * min_height / im.height), min_height), resample=resample)
# for im in im_list]
# total_width = sum(im.width for im in im_list_resize) + (len(im_list_resize) -1) * space_width
dst = Image.new('RGB', (total_init_width, max_height),(255,255,255))
pos_x = 0
for im in im_list:
......@@ -170,11 +170,11 @@ def saveImage(image,name,path,date=True):
now = datetime.datetime.now()
now_string = now.strftime("%Y-%m-%d__%H-%M-%S")
if path == None:
image.image.save(now_string+'---'+name+'.png', 'PNG')
image.image.save(now_string+'---'+name+'.jpeg', 'jpeg',optimize=True,quality=85)
else:
image.image.save(path+'/'+now_string+'---'+name+'.png', 'PNG')
image.image.save(path+'/'+now_string+'---'+name+'.jpeg', 'jpeg',optimize=True,quality=85)
else:
if path == None:
image.image.save(name+'.png', 'PNG')
image.image.save(name+'.jpeg', 'jpeg',optimize=True,quality=85)
else:
image.image.save(path+'/'+name+'.png', 'PNG')
image.image.save(path+'/'+name+'.jpeg', 'jpeg',optimize=True,quality=85)
......@@ -268,7 +268,13 @@ def beta_reduction_totale(terme, path, saveImages=True):
return (terme)
else:
if path == None:
if annotate_reductor(terme) != None:
captureImage(annotate_reductor(terme), None)
else:
captureImage(terme, None)
else:
if annotate_reductor(terme) != None:
captureImage(annotate_reductor(terme), path)
else:
captureImage(terme,path)
if beta_reduction(terme) != None:
......
......@@ -8,7 +8,12 @@ import time
import pyfiglet
import keyboard
import shutil
import platform
if platform.system() == 'Windows':
clear = lambda: os.system('cls')
else:
clear = lambda: os.system('clear')
welcome_banner = pyfiglet.figlet_format('LambdaCalculus Interpreter')
good_bye_banner = pyfiglet.figlet_format('Goodbye!')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment