This commit is contained in:
cwx committed 2022-12-06 20:34:58 +08:00
1 parent 7cf795b660
commit a97acb7595
2 files changed
+13 -4

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ from utils.entity.RouMan import comicEntity
if __name__ == '__main__': if __name__ == '__main__':
# os.environ["http_proxy"] = "http://127.0.0.1:7890" # os.environ["http_proxy"] = "http://127.0.0.1:7890"
# os.environ["https_proxy"] = "http://127.0.0.1:7890" # os.environ["https_proxy"] = "http://127.0.0.1:7890"
# url = "https://rm01.xyz/books/f08668a4-0cbc-488e-95a7-3c71de0c7a31/1" # url = "https://rm01.xyz/books/3700b70b-c5a9-4328-9ae3-cffda6a77339/15"
# comicEntity.comicChapter(url,scramble=True) # comicEntity.comicChapter(url,scramble=True)
# comicEntity.oneComic("https://rm01.xyz/books/c94f80c1-a673-4c74-bb5e-ad5ac7dd766b") # comicEntity.oneComic("https://rm01.xyz/books/c94f80c1-a673-4c74-bb5e-ad5ac7dd766b")
for x in range(0,20): for x in range(0,20):
+12 -3
View File
@@ -53,8 +53,14 @@ class imageUtils:
split_path = os.path.join(baseDir,save_name_delesu+"split") split_path = os.path.join(baseDir,save_name_delesu+"split")
if image_su == "downloads": if image_su == "downloads":
return None return None
cls.splitimage(file_path,blocks,1,split_path) is_split = cls.splitimage(file_path,blocks,1,split_path)
if not is_split == None:
cls.image_compose(split_path,blocks,1,save_file_path,blockHeight,width) cls.image_compose(split_path,blocks,1,save_file_path,blockHeight,width)
else:
if os.path.exists(split_path):
shutil.rmtree(split_path)
if os.path.exists(file_path):
shutil.move(file_path, save_file_path)
#完成后清空 #完成后清空
return file_path return file_path
@@ -62,6 +68,7 @@ class imageUtils:
def splitimage(cls,src,rownum,colnum,dstpath): def splitimage(cls,src,rownum,colnum,dstpath):
img=Image.open(src) img=Image.open(src)
w,h=img.size w,h=img.size
if rownum<= h and colnum<=w:
s=os.path.split(src) s=os.path.split(src)
if dstpath=='': if dstpath=='':
dstpath = s[0] dstpath = s[0]
@@ -81,8 +88,10 @@ class imageUtils:
print("file_path=",file_path) print("file_path=",file_path)
img.crop(box).save(file_path) img.crop(box).save(file_path)
num=num+1 num=num+1
img.close return "成功"
return src else:
print('不数!')
return None
@classmethod @classmethod
def image_compose(cls,src,row,column,save_path,image_height,image_width): def image_compose(cls,src,row,column,save_path,image_height,image_width):