mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
add avif read support
This commit is contained in:
parent
96223fda01
commit
53657ccfff
|
@ -436,6 +436,9 @@ enable video thumbnails:
|
||||||
enable reading HEIF pictures:
|
enable reading HEIF pictures:
|
||||||
* `pyheif-pillow-opener` (requires Linux or a C compiler)
|
* `pyheif-pillow-opener` (requires Linux or a C compiler)
|
||||||
|
|
||||||
|
enable reading AVIF pictures:
|
||||||
|
* `pillow-avif-plugin`
|
||||||
|
|
||||||
|
|
||||||
## install recommended deps
|
## install recommended deps
|
||||||
```
|
```
|
||||||
|
|
|
@ -27,6 +27,12 @@ try:
|
||||||
except:
|
except:
|
||||||
HAVE_HEIF = False
|
HAVE_HEIF = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
HAVE_AVIF = True
|
||||||
|
import pillow_avif
|
||||||
|
except:
|
||||||
|
HAVE_AVIF = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Image.new("RGB", (2, 2)).save(BytesIO(), format="webp")
|
Image.new("RGB", (2, 2)).save(BytesIO(), format="webp")
|
||||||
HAVE_WEBP = True
|
HAVE_WEBP = True
|
||||||
|
@ -38,13 +44,16 @@ except:
|
||||||
|
|
||||||
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html
|
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html
|
||||||
# ffmpeg -formats
|
# ffmpeg -formats
|
||||||
FMT_PIL, FMT_FF = [
|
FMT_PIL = "bmp dib gif icns ico jpg jpeg jp2 jpx pcx png pbm pgm ppm pnm sgi tga tif tiff webp xbm dds xpm"
|
||||||
{x: True for x in y.split(" ") if x}
|
FMT_FF = "av1 asf avi flv m4v mkv mjpeg mjpg mpg mpeg mpg2 mpeg2 mov 3gp mp4 ts mpegts nut ogv ogm rm vob webm wmv"
|
||||||
for y in [
|
|
||||||
"bmp dib gif icns ico jpg jpeg jp2 jpx pcx png pbm pgm ppm pnm sgi tga tif tiff webp xbm dds xpm",
|
if HAVE_HEIF:
|
||||||
"av1 asf avi flv m4v mkv mjpeg mjpg mpg mpeg mpg2 mpeg2 mov 3gp mp4 ts mpegts nut ogv ogm rm vob webm wmv",
|
FMT_PIL += " heif heifs heic heics"
|
||||||
]
|
|
||||||
]
|
if HAVE_AVIF:
|
||||||
|
FMT_PIL += " avif avifs"
|
||||||
|
|
||||||
|
FMT_PIL, FMT_FF = [{x: True for x in y.split(" ") if x} for y in [FMT_PIL, FMT_FF]]
|
||||||
|
|
||||||
|
|
||||||
THUMBABLE = {}
|
THUMBABLE = {}
|
||||||
|
|
Loading…
Reference in a new issue