Skip to content

FIX: handle grayscale and palette images in rotation and saturation converters - #3107

Merged
Richard Lundeen (richlundeen) merged 4 commits into
microsoft:mainfrom
u7k4rs6:fix/image-converter-modes
Oct 11, 2026
Merged

Richard Lundeen (richlundeen) merged 4 commits into
microsoft:mainfrom
u7k4rs6:fix/image-converter-modes

Conversation

@u7k4rs6

Copy link
Copy Markdown
Contributor

Fixes #3106.

Adds _convert_to_rgb_or_rgba to the image-to-image base: RGB/RGBA pass through, anything else becomes RGBA if it has transparency, otherwise RGB.

  • Rotation converts before rotating, since the fill color is always an RGB tuple.
  • Saturation converts everything except L/LA, which ImageEnhance.Color already handles (saturation does nothing on gray anyway).

JPEG output was already converted to RGB, and RGB/RGBA inputs are untouched, so existing outputs don't change.

Tests: rotation over L, LA, 1, I;16 and P (and the corner pixel gets the fill color), saturation over P, 1, I;16, L and LA. 8 of them fail on main. tests/unit/converter: 2079 passed.

Check exact PNG alpha values for palette transparency metadata, LA, and RGBA through rotation and saturation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a7128b5d-cac7-4687-810c-261034db97e0
@richlundeen
Richard Lundeen (richlundeen) added this pull request to the merge queue Oct 11, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 11, 2026
@richlundeen
Richard Lundeen (richlundeen) added this pull request to the merge queue Oct 11, 2026
Merged via the queue into microsoft:main with commit f71cdf7 Oct 11, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: image rotation and saturation converters crash on grayscale and palette PNGs

3 participants