From e490cbe0fe7c4156f9621040adf8e527bf6dbc61 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Thu, 23 Apr 2026 16:57:27 +0000 Subject: [PATCH] Set avif=1 flag for SVT-AV1 when encoding a single image, for increased efficiency and less memory usage. --- cista/preview.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cista/preview.py b/cista/preview.py index e36f851..69057f7 100644 --- a/cista/preview.py +++ b/cista/preview.py @@ -168,7 +168,14 @@ def process_image(path, *, maxsize, quality): # Save as AVIF imgdata = io.BytesIO() t_save = perf_counter() - img.save(imgdata, format="avif", quality=quality, speed=10, max_threads=1) + img.save( + imgdata, + format="avif", + quality=quality, + speed=10, + max_threads=1, + avif=1, + ) t_end = perf_counter() ret = imgdata.getvalue() @@ -198,7 +205,9 @@ def process_pdf(path, *, maxsize, maxzoom, quality, page_number=0): t_load_end = perf_counter() t_save_start = perf_counter() - ret = pix.pil_tobytes(format="avif", quality=quality, speed=10, max_threads=1) + ret = pix.pil_tobytes( + format="avif", quality=quality, speed=10, max_threads=1, avif=1 + ) t_save_end = perf_counter() logger.debug(