Skip to content

Commit 3b903b7

Browse files
committed
Add webp image format support
1 parent 106c0e0 commit 3b903b7

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ To install Variety from source, you will need Git, Python 3.8+ and [distutils-ex
7373
- *Optional*: libayatana-appindicator (for AppIndicator support)
7474
- *Optional*: for tray icon support on GNOME, the [GNOME AppIndicator extension](https://github.com/ubuntu/gnome-shell-extension-appindicator)
7575
- *Optional*: libavif-gdk-pixbuf (for avif format support)
76+
- *Optional*: webp-pixbuf-loader (for webp format support)
7677

7778
See `debian/control` for an equivalent list of runtime dependencies on Debian/Ubuntu.
7879

debian/control

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Depends: gir1.2-gdkpixbuf-2.0,
3636
Recommends: gir1.2-ayatanaappindicator3-0.1 | gir1.2-appindicator3-0.1,
3737
python3-httplib2,
3838
fortune-mod,
39-
libavif-gdk-pixbuf
39+
libavif-gdk-pixbuf,
40+
webp-pixbuf-loader
4041
Suggests: feh | nitrogen,
4142
gnome-shell-extension-appindicator | gnome-shell-extension-top-icons-plus
4243
Description: Wallpaper changer, downloader and manager

variety/ImageFetcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def url_ok(url, use_whitelist, hosts_whitelist):
3737
if h and p.netloc.lower().find(h) >= 0:
3838
return True
3939
else:
40-
return p.path.lower().endswith((".jpg", ".jpeg", ".png", ".tiff", ".avif"))
40+
return p.path.lower().endswith((".jpg", ".jpeg", ".png", ".tiff", ".avif", ".webp"))
4141
# skip gif - they are usually small images
4242
return False
4343
except Exception:

variety/Util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def is_image(filename, check_contents=False):
374374

375375
if not check_contents:
376376
return filename.lower().endswith(
377-
(".jpg", ".jpeg", ".gif", ".png", ".tiff", ".svg", ".bmp", ".avif")
377+
(".jpg", ".jpeg", ".gif", ".png", ".tiff", ".svg", ".bmp", ".avif", ".webp")
378378
)
379379
else:
380380
format, image_width, image_height = GdkPixbuf.Pixbuf.get_file_info(filename)

0 commit comments

Comments
 (0)