1 Commits
Author SHA1 Message Date
clawbot bde983d483 Save PNG compressed, WebP at effort 4 and AVIF at effort 1 (closes #232)
check / check (push) Waiting to run
Each output format now has its own govips export with its settings
named, in place of govips' generic Export, which sent libvips a zero for
some settings it was not given: PNG had no compression and WebP effort
0. PNG now gets libvips' default compression, 6, and WebP its default
effort, 4. GIF was already at libvips' default effort, and JPEG output
is unchanged.

AVIF was at libvips' default effort, 4, which takes minutes for an
8192x8192 image with one libvips thread, far past the default
downstream_timeout; effort 1 takes about 12 seconds. A 16-bit source,
which libvips would save with 12 bits per sample, gets 8: at effort 1,
12 bits take about 54 seconds.

Model: opus-5-5
2026-10-08 10:52:39 +00:00
2 changed files with 12 additions and 17 deletions
+6 -9
View File
@@ -36,15 +36,12 @@ P2: security: per-IP rate limiting on the image routes
it was not given. PNG gets libvips' default compression, 6, where it had none, it was not given. PNG gets libvips' default compression, 6, where it had none,
and WebP libvips' default effort, 4, where it had 0. GIF was already at and WebP libvips' default effort, 4, where it had 0. GIF was already at
libvips' default effort, 7, and JPEG output is unchanged. AVIF is saved at libvips' default effort, 7, and JPEG output is unchanged. AVIF is saved at
effort 1, the lowest govips can set, where it had libvips' default, 4. With effort 1, where it had libvips' default, 4: with one libvips thread, an
one libvips thread, an 8192x8192 image of random pixels, the worst case, takes 8192x8192 image takes minutes at 4, far past the default `downstream_timeout`,
about 51 seconds as AVIF at effort 1 and 43 as WebP at effort 4, against the and about 12 seconds at 1. AVIF is also saved with 8 bits per sample from a
default `downstream_timeout` of 60 seconds. On an image of milder noise, which 16-bit source, which libvips would save with 12: a 16-bit 8192x8192 image
AVIF at effort 1 saves in about 12 seconds, effort 4 takes minutes. AVIF is takes about 54 seconds at effort 1 with 12 bits, nearly all of the default
also saved with 8 bits per sample from a 16-bit source, which libvips would `downstream_timeout`, and about 12 with 8.
save with 12: a 16-bit 8192x8192 image of milder noise takes about 54 seconds
at effort 1 with 12 bits, nearly all of the default `downstream_timeout`, and
about 12 with 8.
- 2026-10-08 JPEG XL is the default output (closes #222): a `/v1/image/` URL - 2026-10-08 JPEG XL is the default output (closes #222): a `/v1/image/` URL
whose last segment is a size with no format, such as `800x600` or `orig`, is whose last segment is a size with no format, such as `800x600` or `orig`, is
served as JPEG XL and signed as `jxl`, so it has the signature of the same URL served as JPEG XL and signed as `jxl`, so it has the signature of the same URL
+6 -8
View File
@@ -588,18 +588,16 @@ func exportWebP(img *vips.ImageRef, quality int) ([]byte, error) {
return output, err return output, err
} }
// avifEffort is the AVIF effort, from 0 (fastest) to 9; 1 is the lowest // avifEffort is the AVIF effort, from 0 (fastest) to 9. With one thread, as
// govips can set. With one thread, as pixad runs libvips, 1 takes about 51 // pixad runs libvips, libvips' default, 4, takes minutes to save an
// seconds to save an 8192x8192 image of random pixels, the worst case, // 8192x8192 image, far past the default downstream_timeout of 60 seconds; 1
// against the default downstream_timeout of 60 seconds. On an image of // takes about 12 seconds, and 2 nearly a minute.
// milder noise, which 1 saves in about 12 seconds, 2 takes nearly a minute
// and libvips' default, 4, takes minutes.
const avifEffort = 1 const avifEffort = 1
// avifBitdepth is the AVIF bit depth, 8 bits per sample for every image. // avifBitdepth is the AVIF bit depth, 8 bits per sample for every image.
// libvips would save a 16-bit image with 12, but at avifEffort that takes // libvips would save a 16-bit image with 12, but at avifEffort that takes
// about 54 seconds for a 16-bit 8192x8192 image of milder noise, nearly all // about 54 seconds for a 16-bit 8192x8192 image, nearly all of the default
// of the default downstream_timeout, and about 12 seconds with 8. // downstream_timeout, and about 12 seconds with 8.
const avifBitdepth = 8 const avifBitdepth = 8
// exportAVIF encodes img as lossy AVIF at quality, avifEffort and // exportAVIF encodes img as lossy AVIF at quality, avifEffort and