Feature/buildimage.pic2bytes gif support (#1761)

Co-authored-by: unknownsno <110149501+unknownsno@users.noreply.github.com>
Co-authored-by: BalconyJH <73932916+BalconyJH@users.noreply.github.com>
This commit is contained in:
HibiKier 2024-12-11 10:40:05 +08:00 committed by GitHub
parent 64b5316570
commit cdcca6e761
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -510,7 +510,13 @@ class BuildImage:
bytes: bytes
"""
buf = BytesIO()
self.markImg.save(buf, format="PNG")
img_format = self.markImg.format.upper() if self.markImg.format else "PNG"
if img_format == "GIF":
self.markImg.save(buf, format="GIF", save_all=True, loop=0)
else:
self.markImg.save(buf, format="PNG")
return buf.getvalue()
def convert(self, type_: ModeType) -> Self:

View File

@ -1 +0,0 @@