diff --git a/projet/Decouper_Image.py b/projet/Decouper_Image.py index aa2cfa6275e6784fdd365d117ca1b5fa2925759f..4b139dd9079ed8c93013e55c68e938ebd52bf912 100644 --- a/projet/Decouper_Image.py +++ b/projet/Decouper_Image.py @@ -13,7 +13,12 @@ def decouper(order: int, im: Image, file: str): """ im = Image.open(file) im_rgb = im.convert('RGB') - size = im.size + size = im_rgb.size + h = size[0] + w = size[1] if order != 0: - block_1, block_2, block_3, block_4 = ( - \ No newline at end of file + 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 diff --git a/projet/ex.py b/projet/ex.py new file mode 100644 index 0000000000000000000000000000000000000000..ad9b403ab1b0f9fd9268e53ffe3926ac659f4c62 --- /dev/null +++ b/projet/ex.py @@ -0,0 +1,12 @@ +from PIL import Image, ImageDraw + +im = Image.open('calbuth.png') +size = im.size +h = size[0] +w = size[1] +cb1 = (0) + +crop_rectangle = ((h//2), (w//2), h, w) +cropped_im = im.crop(crop_rectangle) + +cropped_im.show() \ No newline at end of file