再次修复

This commit is contained in:
caiwx86 2022-12-06 17:48:08 +08:00
parent d188ef2b33
commit 4c838fb1ed
2 changed files with 13 additions and 5 deletions

View File

@ -48,5 +48,10 @@ class CBZUtils:
def packAutoComicChapterCBZ(cls):
chapter_path = comicInfo.getDirComicChapter()
packCBZ_path = comicInfo.getDirCBZComicChapter()
if os.path.exists(chapter_path):
dirs = os.listdir(chapter_path)
for file in dirs:
if file.startswith("scramble="):
os.remove(file)
cls.zip_compression(chapter_path,packCBZ_path+".CBZ")
comicInfo.nextCBZToDoneChapter()

View File

@ -54,7 +54,7 @@ class imageUtils:
if image_su == "downloads":
return None
cls.splitimage(file_path,blocks,1,split_path)
cls.image_compose(split_path+"/",blocks,1,save_file_path,blockHeight,width)
cls.image_compose(split_path,blocks,1,save_file_path,blockHeight,width)
#完成后清空
return file_path
@ -85,6 +85,7 @@ class imageUtils:
else:
print('不数!')
img.close
return src
@classmethod
def image_compose(cls,src,row,column,save_path,image_height,image_width):
@ -102,7 +103,7 @@ class imageUtils:
img_nums=len(img_list)
image_names = []
for i in range(img_nums):
img_name=src+img_list[i]
img_name=os.path.join(src,img_list[i])
image_names.append(img_name)
#使用倒序
image_names = image_names[::-1]
@ -115,13 +116,14 @@ class imageUtils:
for y in range(1, row + 1):
for x in range(1, column + 1):
#1 * (row=1 -1) col=1 -1
image_path = src + image_names[column * (y - 1) + x - 1]
image_path = image_names[column * (y - 1) + x - 1]
print("split_image=",image_path)
from_image = Image.open(image_path)
#保持原图片大小
#.resize(
# (image_size, image_size),Image.ANTIALIAS)
to_image.paste(from_image, ((x - 1) * image_size, (y - 1) * image_size))
from_image.close()
to_image.save(save_path)
print("图片合并完成:", save_path)
shutil.rmtree(src)
@ -130,5 +132,6 @@ class imageUtils:
@classmethod
def getScrambleImage(cls,path):
scrambleFileCache = cls.scrambleImage(path)
if os.path.exists(scrambleFileCache):
os.remove(scrambleFileCache)
if not scrambleFileCache == None:
if os.path.exists(scrambleFileCache):
os.remove(scrambleFileCache)