Fill transparent areas with white in JPEG output (closes #362) #373

Merged
clawbot merged 2 commits from issue-362-jpeg-white-background into next 2026-11-19 07:55:14 +01:00
Collaborator

Closes #362.

JPEG has no transparency. libvips filled transparent areas with black when saving JPEG, so a logo on a transparent background came back on a black square. exportJPEG now flattens any image with an alpha channel onto white before saving. Partly transparent pixels blend with white. This covers both a .jpeg URL and auto when it chooses JPEG, and SVG sources rendered as JPEG, since all of them go through exportJPEG. The README's format section says so.

Two commits, kept apart on purpose: the first adds a test that fails against the old code, and the second is the fix, with no test changed. The test covers 8-bit RGBA, 16-bit RGBA, and grey with alpha. govips scales the white for 16-bit images.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/pixa/issues/362. JPEG has no transparency. libvips filled transparent areas with black when saving JPEG, so a logo on a transparent background came back on a black square. `exportJPEG` now flattens any image with an alpha channel onto white before saving. Partly transparent pixels blend with white. This covers both a `.jpeg` URL and `auto` when it chooses JPEG, and SVG sources rendered as JPEG, since all of them go through `exportJPEG`. The README's format section says so. Two commits, kept apart on purpose: the first adds a test that fails against the old code, and the second is the fix, with no test changed. The test covers 8-bit RGBA, 16-bit RGBA, and grey with alpha. govips scales the white for 16-bit images. Model: opus-5-5
clawbot added the needs-review label 2026-11-19 07:30:30 +01:00
clawbot added 2 commits 2026-11-19 07:30:30 +01:00
The test fails now: libvips fills them with black.

Model: opus-5-5
JPEG has no transparency, and libvips filled transparent areas with
black, so a logo on a transparent background came back on a black
square. The README now says JPEG output is filled with white.

Model: opus-5-5
clawbot self-assigned this 2026-11-19 07:30:32 +01:00
Author
Collaborator

Verdict: PASS
Head: c9040dee20

JPEG output now fills transparent areas with white as the proposal in #362 asked, the README says so, and the change is the sanctioned two-commit shape (failing test, then fix), so rebase-merge it with both commits kept.

Model: opus-5-5

Verdict: PASS Head: c9040dee203c9e3df8892407514ad8ac1ffbf126 JPEG output now fills transparent areas with white as the proposal in https://git.eeqj.de/sneak/pixa/issues/362 asked, the README says so, and the change is the sanctioned two-commit shape (failing test, then fix), so rebase-merge it with both commits kept. Model: opus-5-5
clawbot merged commit c9040dee20 into next 2026-11-19 07:55:14 +01:00
clawbot deleted branch issue-362-jpeg-white-background 2026-11-19 07:55:16 +01:00
Sign in to join this conversation.