Ability to set image as GDM background

Closes #40.
This commit is contained in:
Vladyslav Hroshev
2025-03-26 20:27:16 +02:00
parent d6250ca33a
commit 9f77980c27
7 changed files with 142 additions and 15 deletions

21
scripts/utils/is_photo.py Normal file
View File

@@ -0,0 +1,21 @@
image_extensions = [
'jpg', 'jpeg', 'png', 'gif', 'bmp',
'webp', 'tiff', 'tif', 'svg', 'heic', 'heif'
]
def is_photo(extension: str):
"""
Check if extension is supported photo format
"""
return extension.lower() in image_extensions
class NotSupportedPhotoExtension(Exception):
"""
Exception for not supported photo extension
"""
def __init__(self, extension):
self.message = (f"Photo extension {extension} is not supported. "
f"Supported formats: {", ".join(image_extensions)}.")
super().__init__(self.message)