JPEG XL (JXL) support

This commit is contained in:
DarthSim
2024-12-08 19:02:08 +03:00
parent 227ec2ec22
commit 3f4edb91f7
9 changed files with 320 additions and 2 deletions

View File

@@ -281,6 +281,8 @@ func ProcessImage(ctx context.Context, imgdata *imagedata.ImageData, po *options
switch {
case po.Format == imagetype.Unknown:
switch {
case po.PreferJxl && !animated:
po.Format = imagetype.JXL
case po.PreferAvif && !animated:
po.Format = imagetype.AVIF
case po.PreferWebP:
@@ -290,6 +292,8 @@ func ProcessImage(ctx context.Context, imgdata *imagedata.ImageData, po *options
default:
po.Format = findBestFormat(imgdata.Type, animated, expectAlpha)
}
case po.EnforceJxl && !animated:
po.Format = imagetype.JXL
case po.EnforceAvif && !animated:
po.Format = imagetype.AVIF
case po.EnforceWebP: