Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
358c5fd3
Commit
358c5fd3
authored
Oct 08, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update script
parent
94d4fb2c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
script/print/screen_maker.py
+55
-0
script/script_help.sh
+5
-0
No files found.
script/print/screen_maker.py
0 → 100644
View file @
358c5fd3
#-*-coding:utf-8-*-
import
os
import
sys
import
random
from
PIL
import
Image
,
ImageDraw
,
ImageFont
text
=
[
"Mudah Diajukan
\n
Pengisian Data Tidak Rumit"
,
\
"Tidak bisa menyelesaikan masalah?
\n
Khawatir tentang masalah pendanaan?"
]
def
draw_bg
(
bg_path
,
logo_path
,
top_path
,
output
):
img_bg
=
Image
.
open
(
bg_path
)
img_logo
=
Image
.
open
(
logo_path
)
img_top
=
Image
.
open
(
top_path
)
text_h
=
random
.
randint
(
0
,
1400
)
logo_h
=
random
.
randint
(
0
,
1400
)
top_h
=
random
.
randint
(
0
,
1400
)
text_index
=
random
.
randint
(
0
,
len
(
text
)
-
1
)
while
abs
(
logo_h
-
text_h
)
<
300
or
abs
(
top_h
-
text_h
)
<
300
:
logo_h
=
random
.
randint
(
0
,
1400
)
top_h
=
random
.
randint
(
0
,
1400
)
# 添加背景
new_img
=
Image
.
new
(
'RGBA'
,
(
img_bg
.
size
[
0
]
*
2
,
img_bg
.
size
[
1
]),
(
0
,
0
,
0
,
0
))
new_img
.
paste
(
img_bg
,
(
0
,
0
))
new_img
.
paste
(
img_bg
,
(
img_bg
.
size
[
0
],
0
))
img_logo
=
img_logo
.
resize
((
300
,
300
),
Image
.
ANTIALIAS
)
img_top
=
img_top
.
resize
((
700
,
342
),
Image
.
ANTIALIAS
)
#logo随机位置
new_img
.
paste
(
img_logo
,
(
random
.
randint
(
0
,
700
),
logo_h
),
mask
=
img_logo
)
new_img
.
paste
(
img_top
,
(
1080
,
top_h
))
# 字体随机大小
font_size
=
random
.
randint
(
120
,
180
)
font
=
ImageFont
.
truetype
(
'Arial.ttf'
,
font_size
)
# 添加字体
new_img
=
new_img
.
convert
(
'RGBA'
)
img_text
=
Image
.
new
(
'RGBA'
,
new_img
.
size
,
(
255
,
255
,
255
,
0
))
image_draw
=
ImageDraw
.
Draw
(
img_text
)
image_draw
.
text
((
random
.
randint
(
0
,
300
),
text_h
),
text
[
text_index
],
font
=
font
,
fill
=
"#FFFFFF"
)
bg_with_text
=
Image
.
alpha_composite
(
new_img
,
img_text
)
# 裁切图片
screen1
=
bg_with_text
.
crop
((
0
,
0
,
img_bg
.
size
[
0
],
img_bg
.
size
[
1
]))
screen2
=
bg_with_text
.
crop
((
img_bg
.
size
[
0
],
0
,
img_bg
.
size
[
0
]
*
2
,
img_bg
.
size
[
1
]))
screen1
.
save
(
output
+
"screen1.png"
,
"PNG"
)
screen2
.
save
(
output
+
"screen2.png"
,
"PNG"
)
draw_bg
(
sys
.
argv
[
1
],
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
])
script/script_help.sh
View file @
358c5fd3
...
...
@@ -306,6 +306,11 @@ elif (($commod == '26')) || (($commod == '266'));then
mv /Users/connor/Documents/apks/
"
${
file_name
}
.apk"
/Users/connor/Documents/apks/
"
${
file_name
}
/app.apk"
mv /Users/connor/Documents/apks/
"
${
file_name
}
.html"
/Users/connor/Documents/apks/
"
${
file_name
}
/privacy.html"
cp ../../../app/src/main/res/drawable-xxhdpi/logo.png /Users/connor/Documents/apks/
"
${
file_name
}
/logo.png"
cp ../../../app/src/main/res/drawable-xxhdpi/top.png /Users/connor/Documents/apks/
"
${
file_name
}
/top.png"
res
=
"../../../app/src/main/res/drawable-xxhdpi"
python screen_maker.py
"
${
res
}
/bg01.png"
"
${
res
}
/logo.png"
"
${
res
}
/top.png"
"/Users/connor/Documents/apks/
${
file_name
}
/"
echo
"截图制作完成"
#elif (($commod == '27'));then
# cd privacy
...
...
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