Skip to content

Commit

Permalink
添加了是否要颜色分类的参数
Browse files Browse the repository at this point in the history
  • Loading branch information
IVEN-CN committed Jan 22, 2024
1 parent d5b889d commit 28957eb
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions office_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import color_div.color_divider
import re
import os

def done(func):
def wrapper(*args, **kwargs):
Expand All @@ -13,7 +14,7 @@ def wrapper(*args, **kwargs):
return wrapper

@done
def main(*num, path): # num是不需要移动到主图文件夹的图片序号,类似于(1),(2),(3)
def main(*num, path, ifcolordiv=True): # num是不需要移动到主图文件夹的图片序号,类似于(1),(2),(3)
list_path = renamer.main1.get_file_path(path)
img1200_path = []
img_path = []
Expand Down Expand Up @@ -58,9 +59,33 @@ def main(*num, path): # num是不需要移动到主图文件夹的图片
# 重命名主图文件夹的文件
renamer.main2.rename2(os.path.join(path, '主图'))

# 颜色分类
color_div.color_divider.main(path=path, erea='area0.npy')
color_div.color_divider.main(path=path, erea='area1.npy')
if ifcolordiv:
# 颜色分类
color_div.color_divider.main(path=path, erea='area0.npy')
color_div.color_divider.main(path=path, erea='area1.npy')
else:
list_path = renamer.main1.get_file_path(path) # 更新list_path
for i in list_path:
if '主图' in i or 'main' in i:
os.remove(i)

folder_names = ['800X1200', '800X800', '750X1000']
for folder_name in folder_names:
folder_path = os.path.join(path, folder_name)
os.makedirs(folder_path, exist_ok=True)
for i in list_path:
if '800' in i:
shutil.move(i, os.path.join(path, '800X1200'))
elif '1000' in i:
shutil.move(i, os.path.join(path, '750X1000'))
elif '1200' in i:
shutil.move(i, os.path.join(path, '800X800'))
else:
pass

if __name__ == '__main__':
main(path=r'D:\41short\KC-41-XOU179')


if __name__ == '__main__':
main(path=r'D:\41short\KC-41-XOU179')

0 comments on commit 28957eb

Please sign in to comment.