File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 3030from gradia .graphics .background import Background
3131from gradia .ui .widget .preset_button import ImagePresetButton
3232from gradia .app_constants import PRESET_IMAGES
33+ from gradia .app_constants import SUPPORTED_EXPORT_FORMATS
3334
3435class ImageBackground (Background ):
3536 @property
@@ -69,7 +70,13 @@ def load_image(self, path: str) -> None:
6970 def save_image_copy_async (self ) -> None :
7071 def save_in_background ():
7172 if self .image :
72- self .image .save (self .SAVED_IMAGE_PATH , 'PNG' )
73+ _ , extension = os .path .splitext (self .SAVED_IMAGE_PATH )
74+ target_format = 'PNG'
75+ for format in SUPPORTED_EXPORT_FORMATS :
76+ if extension .lower () in format ['extensions' ]:
77+ target_format = format ['shortname' ]
78+ break
79+ self .image .save (self .SAVED_IMAGE_PATH , target_format )
7380
7481 thread = threading .Thread (target = save_in_background , daemon = True )
7582 thread .start ()
You can’t perform that action at this time.
0 commit comments