From 8554d1af0cef17ff5cc6b7cee9c882776f06673a Mon Sep 17 00:00:00 2001
From: Kinadinova Dariya <dariya.kinadinova.etu@118p27.fil.univ-lille.fr>
Date: Wed, 27 Mar 2024 10:47:14 +0100
Subject: [PATCH] decouper function

---
 projet/Decouper_Image.py | 11 ++++++++---
 projet/ex.py             | 12 ++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 projet/ex.py

diff --git a/projet/Decouper_Image.py b/projet/Decouper_Image.py
index aa2cfa6..4b139dd 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 0000000..ad9b403
--- /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
-- 
GitLab