forked from mirrors/cbz
Implementation save to file page
This commit is contained in:
committed by
Oleskii Pyskun
parent
9dced03251
commit
9ef572f05e
@@ -175,3 +175,12 @@ class ComicInfo(ComicModel):
|
||||
:return:
|
||||
"""
|
||||
return self.__pages
|
||||
|
||||
def save_page(self, index: int, path: Union[Path, str]) -> None:
|
||||
"""
|
||||
Save page to the file
|
||||
:param index: page index
|
||||
:param path: path to new file, str or Path
|
||||
:return:
|
||||
"""
|
||||
self.__pages[index].save(path)
|
||||
|
||||
@@ -68,3 +68,12 @@ class PageInfo(PageModel):
|
||||
"""
|
||||
with Image.open(BytesIO(self.content)) as image:
|
||||
image.show()
|
||||
|
||||
def save(self, path: Union[Path, str]):
|
||||
"""
|
||||
Save page to file
|
||||
:param path:
|
||||
:return:
|
||||
"""
|
||||
with Path(path).open(mode='wb') as f:
|
||||
f.write(self.content)
|
||||
|
||||
Reference in New Issue
Block a user