feat(server): add jxl as target format (#32732)

(cherry picked from commit 9560989cb97fb93cd6ab74f7811acce133a9b768)
This commit is contained in:
Mert
2026-10-27 23:12:52 +03:00
committed by Codex
parent f1a09c1389
commit db411a4497
15 changed files with 167 additions and 30 deletions
@@ -7,10 +7,14 @@ import numpy as np
import orjson
from numpy.typing import NDArray
from PIL import Image
from pillow_jxl import JpegXLImagePlugin
_PIL_RESAMPLING_METHODS = {resampling.name.lower(): resampling for resampling in Image.Resampling}
_PUNCTUATION_TRANS = str.maketrans("", "", string.punctuation)
# Requests are already decoded in parallel, so don't start a thread per core for each one
JpegXLImagePlugin.DECODE_THREADS = 0
def resize_pil(img: Image.Image, size: int, resample: Image.Resampling = Image.Resampling.BICUBIC) -> Image.Image:
if img.width < img.height: