Commit 8f41392
committed
Tighten libvips encoder options and ping robustness
API-review findings (cf. ruby-vips 2.3 / libvips 8.15 docs):
* `strip: true` → `keep: :none`. Soft-deprecated in libvips 8.15 in
favour of the bitmask `keep:` form. Same effect today, future-proof
later; output bytes are unchanged.
* `subsample_mode: :on` added explicitly to both writes. libvips'
default `:auto` disables 4:2:0 chroma subsampling for Q >= 90, which
would silently inflate output ~20-30% if a user bumps the
collection-metadata `quality` past that threshold. For a photo
gallery 4:2:0 is the right call across the quality range; pin it.
At the current defaults (full Q85, thumb Q80) the auto mode would
have produced the same output, so today the change is a no-op on
the byte stream.
* `fail_on: :error` added to the `Vips::Image.new_from_file` ping in
`ImageFile#initialize`. For a build tool, a truncated or corrupt
source JPEG should abort the build with a clear error rather than
silently rendering a half-grey output. Default is `:none` (warnings
ignored), which is the wrong default for our use case.
Three mozjpeg-style options (`trellis_quant`, `overshoot_deringing`,
`optimize_scans`) were considered and skipped: libvips on Ubuntu
24.04 is built against stock libjpeg-turbo, not mozjpeg, so passing
them emits warnings and has no effect. Worth revisiting if the CI
matrix ever picks up a mozjpeg-libvips build.
cache_spec spy counts and the `geometry_string` cache fingerprint
are unaffected. The bench delta on the small workload is within noise
of the pre-tweak libvips numbers.
https://claude.ai/code/session_01AZQRrnPUpfUMCXLu3oTSDN1 parent 549423d commit 8f41392
3 files changed
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
0 commit comments