PNG output is saved uncompressed, and WebP, AVIF and GIF at the lowest effort #232

Open
opened 2026-10-08 09:35:50 +02:00 by clawbot · 1 comment
Collaborator

internal/imageprocessor saves every output through govips' generic Export with only the format and the quality set (encode in imageprocessor.go). Every other encoder setting arrives as Go's zero value instead of libvips' default. The review of #231 noticed the first of these:

  • PNG: Compression 0, so libvips saves PNG with no compression at all. A 200x150 PNG came out at 90,381 bytes, the size of its raw pixels. libvips' default is 6.
  • WebP: ReductionEffort 0, the lowest effort, which gives larger files. libvips' default is 4.
  • AVIF: effort 0, the lowest, which gives larger files. libvips' default is 4.
  • GIF: effort 0, where libvips' default is 7.

#230 found the same trap for JPEG XL and works around it there.

Definition of done

  • Each output format is saved with settings pixa chooses on purpose: libvips' defaults unless there is a measured reason for another value, with q still setting the quality. Recommended: call each format's own govips export with its parameters set explicitly, the way #230 does for JPEG XL, rather than the generic Export.
  • Effort costs time. Measure the worst case (an 8192x8192 image) for WebP and AVIF at the chosen effort on this host against downstream_timeout. Give the numbers in one line in the PR body, without logs.
  • Tests, each failing first: a compressible PNG output is much smaller than its raw pixels; for WebP and AVIF, the output matches the size of the same image saved with the chosen settings, or another plain check that the settings reach libvips.
  • README.md changes only where it describes output encoding, if it does.

Model: opus-5-5

`internal/imageprocessor` saves every output through govips' generic `Export` with only the format and the quality set (`encode` in `imageprocessor.go`). Every other encoder setting arrives as Go's zero value instead of libvips' default. The review of https://git.eeqj.de/sneak/pixa/pulls/231 noticed the first of these: - PNG: `Compression` 0, so libvips saves PNG with no compression at all. A 200x150 PNG came out at 90,381 bytes, the size of its raw pixels. libvips' default is 6. - WebP: `ReductionEffort` 0, the lowest effort, which gives larger files. libvips' default is 4. - AVIF: effort 0, the lowest, which gives larger files. libvips' default is 4. - GIF: effort 0, where libvips' default is 7. https://git.eeqj.de/sneak/pixa/pulls/230 found the same trap for JPEG XL and works around it there. ## Definition of done - Each output format is saved with settings pixa chooses on purpose: libvips' defaults unless there is a measured reason for another value, with `q` still setting the quality. Recommended: call each format's own govips export with its parameters set explicitly, the way https://git.eeqj.de/sneak/pixa/pulls/230 does for JPEG XL, rather than the generic `Export`. - Effort costs time. Measure the worst case (an 8192x8192 image) for WebP and AVIF at the chosen effort on this host against `downstream_timeout`. Give the numbers in one line in the PR body, without logs. - Tests, each failing first: a compressible PNG output is much smaller than its raw pixels; for WebP and AVIF, the output matches the size of the same image saved with the chosen settings, or another plain check that the settings reach libvips. - `README.md` changes only where it describes output encoding, if it does. Model: opus-5-5
clawbot self-assigned this 2026-10-08 09:35:50 +02:00
Author
Collaborator

#234 gives each output format its own export with its settings named: PNG at compression 6 and WebP at effort 4, libvips' defaults, and AVIF at effort 1 rather than libvips' default 4, which takes minutes to save an 8192x8192 image, far past downstream_timeout. GIF and JPEG output does not change. The measurements and disclosures are in the PR body.

Model: opus-5-5

https://git.eeqj.de/sneak/pixa/pulls/234 gives each output format its own export with its settings named: PNG at compression 6 and WebP at effort 4, libvips' defaults, and AVIF at effort 1 rather than libvips' default 4, which takes minutes to save an 8192x8192 image, far past `downstream_timeout`. GIF and JPEG output does not change. The measurements and disclosures are in the PR body. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#232