Skip to content

Preserve translucent fill colors in image transforms - #10234

Closed
antonsoo wants to merge 1 commit into
python-pillow:mainfrom
antonsoo:fix/image-transform-nj4f
Closed

antonsoo wants to merge 1 commit into
python-pillow:mainfrom
antonsoo:fix/image-transform-nj4f

Conversation

@antonsoo

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • Preserve the requested fillcolor for bilinear/bicubic RGBA and LA transforms, including rotations. For example, an affine transform requesting (128, 64, 32, 128) currently produces (255, 127, 63, 128) outside the source image.
  • Apply the fill after converting back from premultiplied alpha. A single-channel transform identifies the exterior with the same sampling coordinates, preserving exact colors even at alpha 0 or 1. Retain the existing behavior of overlapping mesh entries and resolve old-style transform objects once.
  • Add regressions and release notes. The full suite passes (5,358 passed, 474 skipped, three expected failures), selftest passes, the canonical Mypy environment passes, and applicable changed-file hooks pass. A native audit of two bundled image assets corrects 48 failing transform configurations and 171,416 exterior pixels, with 120 complete output controls and every interior pixel unchanged. The extra mask transform runs only for explicit fills on interpolated alpha images.

@radarhere radarhere added the 🤖-assisted AI-assisted label Oct 18, 2026
@radarhere

radarhere commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Hi. This is similar to #10114

It looks like you used AI to create this PR. Did you actually encounter this problem yourself when using Pillow? Or is this just AI finding a bug and then AI fixing the bug?

@antonsoo

Copy link
Copy Markdown
Contributor Author

Yes. AI found and implemented this during an automated transform audit. I did not encounter it in an application I was building. I understand the distinction you described in #10114, so I’m closing this PR.

@antonsoo antonsoo closed this Oct 18, 2026
@hugovk

hugovk commented Oct 18, 2026

Copy link
Copy Markdown
Member

What is a "transform audit"?

@antonsoo

Copy link
Copy Markdown
Contributor Author

I meant an AI agent testing image transforms for bugs. It chose the transform cases, compared the output pixels with reference calculations, and wrote the fix and tests. This did not start from a problem I had encountered in an application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-assisted AI-assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants