Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson22-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cb87c3e5
authored
Jun 19, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
7ec5ea29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
diy1.py
diy1.py
View file @
cb87c3e5
...
@@ -11,4 +11,14 @@ path=filedialog.askopenfilenames(title='选择图片文件',
...
@@ -11,4 +11,14 @@ path=filedialog.askopenfilenames(title='选择图片文件',
filetypes
=
[(
'png'
,
'.png'
)],
filetypes
=
[(
'png'
,
'.png'
)],
initialdir
=
'./'
)
initialdir
=
'./'
)
print
(
path
)
#生成GIF动图
img_list
=
[]
# 建立空列表
for
i
in
path
:
# for循环遍历变量path提取变量i
# Image.open()方法参数为i赋值给变量img
img
=
Image
.
open
(
i
)
# 列表名.append()方法参数为img
img_list
.
append
(
img
)
# 列表img_list[0].save()方法
# 参数1文件命名,参数2save_all设为True,参数3append_images设为img_list[1:]取出第二到结尾所有图片
img_list
[
0
]
.
save
(
"bot.gif"
,
save_all
=
True
,
append_images
=
img_list
[
1
:])
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment