Repository navigation
Convert LA images when pasting into RGB images - #10525
Merged
Merged
Conversation
radarhere
enabled auto-merge (squash)
November 16, 2026 19:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10524.
Changes proposed in this pull request:
Image.paste()skipped conversion for LA images pasted into RGB images, copying the stored bytes directly. That assumed the two padding bytes of an LA pixel hold copies of the L value, butImage.merge()andpoint()leave them as zero (and Set padding bytes in new 2 channel images to zero #10511 zeroes them forImage.new()as well), so a grey LA pixel pasted as red, e.g.(128, 0, 0)instead of(128, 128, 128). LA is now converted like other modes when pasting into RGB; RGBA and RGBa keep the direct copy, since their first three stored bytes really are R, G and B.Image.new(),Image.merge()andpoint()into an RGB image. The test fails without theImage.pychange and passes with it.Test results:
Tests/test_image_paste.py(61 passed), plusTests/test_image.py,Tests/test_image_convert.pyandTests/test_image_point.py(274 passed, 2 skipped for unavailable features).This change was prepared with the help of an AI coding assistant.