Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP-KINADINOVA-Dariya
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dariya Kinadinova
AP-KINADINOVA-Dariya
Commits
6f9862a5
Commit
6f9862a5
authored
1 year ago
by
Dariya Kinadinova
Browse files
Options
Downloads
Patches
Plain Diff
Update file block.py
parent
65aa1ef6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projet/codes/block.py
+9
-12
9 additions, 12 deletions
projet/codes/block.py
with
9 additions
and
12 deletions
projet/codes/block.py
+
9
−
12
View file @
6f9862a5
...
...
@@ -85,22 +85,19 @@ class Block:
# Si le bloc est uniforme, une nouvelle image est cree
im
=
Image
.
new
(
'
RGB
'
,
size
,
self
.
color
)
else
:
# Calculer les tailles
upper_left_size
=
(
size
[
0
]
//
2
,
size
[
1
]
//
2
)
upper_right_size
=
(
size
[
0
]
//
2
,
size
[
1
]
//
2
)
lower_left_size
=
(
size
[
0
]
//
2
,
size
[
1
]
//
2
)
lower_right_size
=
(
size
[
0
]
//
2
,
size
[
1
]
//
2
)
# Calculer la taille
sub_block_size
=
(
size
[
0
]
//
2
,
size
[
1
]
//
2
)
# transformer chaque sous-bloc en image
upper_left_im
=
self
.
upper_left_block
.
block_to_image
(
upper_left
_size
)
upper_right_im
=
self
.
upper_right_block
.
block_to_image
(
upper_right
_size
)
lower_left_im
=
self
.
lower_left_block
.
block_to_image
(
lower_left
_size
)
lower_right_im
=
self
.
lower_right_block
.
block_to_image
(
lower_right
_size
)
upper_left_im
=
self
.
upper_left_block
.
block_to_image
(
sub_block
_size
)
upper_right_im
=
self
.
upper_right_block
.
block_to_image
(
sub_block
_size
)
lower_left_im
=
self
.
lower_left_block
.
block_to_image
(
sub_block
_size
)
lower_right_im
=
self
.
lower_right_block
.
block_to_image
(
sub_block
_size
)
# Creer une nouvelle image et coller les sous-blocs
im
=
Image
.
new
(
'
RGB
'
,
size
)
im
.
paste
(
upper_left_im
,
(
0
,
0
))
im
.
paste
(
upper_right_im
,
(
upper_left
_size
[
0
],
0
))
im
.
paste
(
lower_left_im
,
(
0
,
upper_left
_size
[
1
]))
im
.
paste
(
lower_right_im
,
(
upper_left_size
[
0
],
upper_left
_size
[
1
]))
im
.
paste
(
upper_right_im
,
(
sub_block
_size
[
0
],
0
))
im
.
paste
(
lower_left_im
,
(
0
,
sub_block
_size
[
1
]))
im
.
paste
(
lower_right_im
,
(
sub_block_size
[
0
],
sub_block
_size
[
1
]))
return
im
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment