Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ap Almohamedalsadou Fatima
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
Fatima Almohamed Alsadou
Ap Almohamedalsadou Fatima
Commits
a77c2069
Commit
a77c2069
authored
1 year ago
by
Fatima Almohamed Alsadou
Browse files
Options
Downloads
Patches
Plain Diff
fonction affiche_image
parent
ec836b65
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projet/affiche_image.py
+12
-14
12 additions, 14 deletions
projet/affiche_image.py
with
12 additions
and
14 deletions
projet/affiche_image.py
+
12
−
14
View file @
a77c2069
...
@@ -2,29 +2,27 @@ imagef=Image.open('images/images/galets.png')
...
@@ -2,29 +2,27 @@ imagef=Image.open('images/images/galets.png')
def
affiche_image
(
fichier
:
str
,
image
:
str
):
def
affiche_image
(
fichier
:
str
,
image
:
str
):
"""
"""
affiche l
'
image dont les coordonnées sont
sont
contenus dans le fichier fichier
affiche l
'
image dont les coordonnées sont contenus dans le fichier fichier
Précondition :
Précondition :
Exemple(s) :
Exemple(s) :
$$$
$$$
"""
"""
coord
=
[]
coord
=
[]
res
=
""
res
=
""
imageaconvertir
=
Image
.
open
(
image
)
imageaconvertir
=
Image
.
open
(
'
calbuth2.png
'
)
im
=
imageaconvertir
.
convert
(
'
RGB
'
)
im
=
imageaconvertir
.
convert
(
'
RGB
'
)
dessin
=
ImageDraw
.
Draw
(
im
)
dessin
=
ImageDraw
.
Draw
(
im
)
with
open
(
fichier
,
'
r
'
)
as
f
:
with
open
(
fichier
,
'
r
'
)
as
f
:
for
line
in
f
:
for
line
in
f
:
l
coord
=
coord_str
(
line
)
for
i
in
range
(
1
,
len
(
line
)
-
2
):
if
len
(
coord
)
==
7
:
if
line
[
i
]
!=
'
,
'
and
line
[
i
]
!=
"'"
:
dessin
.
rectangle
(((
coord
[
0
],
coord
[
1
]),(
coord
[
2
],
coord
[
3
])),
fill
=
(
coord
[
4
],
coord
[
5
],
coord
[
6
]))
res
+=
(
line
[
i
])
else
:
elif
len
(
coord
)
==
4
:
res
.
strip
()
dessin
.
rectangle
(((
coord
[
0
],
coord
[
1
]),(
coord
[
2
],
coord
[
3
])),
fill
=
None
)
coord
.
append
(
int
(
res
))
im
.
show
()
for
i
in
range
(
0
,
len
(
coord
),
6
):
dessin
.
rectangle
(((
coord
[
i
],
coord
[
i
+
1
]),(
coord
[
i
+
2
],
coord
[
i
+
3
])),
fill
=
(
coord
[
i
+
4
],
coord
[
i
+
5
],
coord
[
i
+
6
]))
im
.
show
()
\ No newline at end of file
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