Implementation save to file page

This commit is contained in:
Oleskii Pyskun
2024-07-02 12:58:31 +03:00
committed by Oleskii Pyskun
parent 9dced03251
commit 9ef572f05e
2 changed files with 18 additions and 0 deletions
+9
View File
@@ -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)
+9
View File
@@ -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)