Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit e64f0551 authored by Michael Bestas's avatar Michael Bestas
Browse files

Remove jpeg check from generate_smallvariants.py

imghdr is not able to recognize some valid jpeg formats
Reference: https://bugs.python.org/issue28591

It was also deprecated in python 3.11 so just remove it
Reference: https://peps.python.org/pep-0594/#imghdr

Change-Id: Ideb9e35515e8c21ef951e44fc37bf4e5bb4335f5
parent cf31e1b6
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
#!/usr/bin/env python3
import imghdr
import os

from PIL import Image
@@ -16,11 +15,6 @@ def generate_smallvariants(resource):
    wallpapers = os.listdir(wallpapers_path)

    for wallpaper in wallpapers:
        # Test if the wallpaper is a valid jpeg file
        if imghdr.what(os.path.join(wallpapers_path, wallpaper)) != "jpeg":
            print(os.path.join(resource, wallpaper) + " is not a valid jpeg file")
            continue

        # Append _small.jpg to the wallpaper
        wallpaper_small = os.path.splitext(wallpaper)[0] + "_small.jpg"
        wallpaper_small_path = os.path.join(wallpapers_path, wallpaper_small)