mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 14:29:26 +08:00
fix: manually register PngImagePlugin for pre init
This commit is contained in:
15
alas.py
15
alas.py
@@ -25,7 +25,22 @@ class AzurLaneAutoScript:
|
||||
AutoRestart_AttemptsToRestart = 0
|
||||
AutoRestart_NotifyWhenAutoRestart = False
|
||||
|
||||
def pre_init(self):
|
||||
from PIL import Image
|
||||
Image.init()
|
||||
|
||||
# Manually register PngImagePlugin
|
||||
from PIL import PngImagePlugin
|
||||
Image.register_open(PngImagePlugin.PngImageFile.format, PngImagePlugin.PngImageFile, PngImagePlugin._accept)
|
||||
Image.register_save(PngImagePlugin.PngImageFile.format, PngImagePlugin._save)
|
||||
Image.register_save_all(PngImagePlugin.PngImageFile.format, PngImagePlugin._save_all)
|
||||
|
||||
Image.register_extensions(PngImagePlugin.PngImageFile.format, [".png", ".apng"])
|
||||
|
||||
Image.register_mime(PngImagePlugin.PngImageFile.format, "image/png")
|
||||
|
||||
def __init__(self, config_name='alas'):
|
||||
self.pre_init()
|
||||
logger.hr('Start', level=0)
|
||||
self.config_name = config_name
|
||||
# Skip first restart
|
||||
|
||||
Reference in New Issue
Block a user