diff --git a/projet/Decouper_Image.py b/projet/Decouper_Image.py index 4b139dd9079ed8c93013e55c68e938ebd52bf912..15c5257804a12c7c31a6c0d4775804ed9ea70b1a 100644 --- a/projet/Decouper_Image.py +++ b/projet/Decouper_Image.py @@ -3,7 +3,7 @@ from PIL import Image, ImageDraw # im = Image.open("calbuth.png") # im_rgb = im.convert('RGB') -def decouper(order: int, im: Image, file: str): +def decouper(im: Image, file: str): """à_remplacer_par_ce_que_fait_la_fonction Précondition : @@ -14,11 +14,13 @@ def decouper(order: int, im: Image, file: str): im = Image.open(file) im_rgb = im.convert('RGB') size = im_rgb.size - h = size[0] - w = size[1] - if order != 0: - crop1 = (0, 0, (h//2), (w//2)) - block_1 = im.crop(crop1) - - crop4 = ((h//2), (w//2), h, w) - block_4 = im.crop(crop4) \ No newline at end of file + w = size[0] + h = size[1] + crop1 = (0, 0, (w//2), (h//2)) + block_1 = im.crop(crop1) + crop2 = ((w//2), 0, w, (h//2)) + block_2 = im.crop(crop2) + crop3 = (0, (h//2), (w//2), h) + block_3 = im.crop(crop3) + crop4 = ((h//2), (w//2), h, w) + block_4 = im.crop(crop4) \ No newline at end of file diff --git a/projet/ex.py b/projet/ex.py index ad9b403ab1b0f9fd9268e53ffe3926ac659f4c62..a480e5dbfe8c89c4e52730e80f45a6d7d6b3c8c8 100644 --- a/projet/ex.py +++ b/projet/ex.py @@ -2,11 +2,11 @@ from PIL import Image, ImageDraw im = Image.open('calbuth.png') size = im.size -h = size[0] -w = size[1] +w = size[0] +h = size[1] cb1 = (0) -crop_rectangle = ((h//2), (w//2), h, w) +crop_rectangle = (0, (h//2), (w//2), h) cropped_im = im.crop(crop_rectangle) cropped_im.show() \ No newline at end of file