Skip to content
Snippets Groups Projects
Commit 6735258c authored by Kinadinova Dariya's avatar Kinadinova Dariya
Browse files

decouper function change

parent 8554d1af
Branches
No related tags found
No related merge requests found
......@@ -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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment