Skip to content

Conversation

@radarhere
Copy link
Member

Pillow/src/PIL/Image.py

Lines 806 to 815 in aa287bc

if mode == "RGBA":
mode = "RGB"
self.info["transparency"] = arr[3::4]
arr = bytes(
value for (index, value) in enumerate(arr) if index % 4 != 3
)
palette_length = self.im.putpalette(mode, arr)
self.palette.dirty = 0
self.palette.rawmode = None
if "transparency" in self.info and mode in ("RGBA", "LA", "PA"):

#5914 points out that mode will never be RGBA in the last line.

Unless I'm reading this incorrectly, the addition of the check on mode means that this won't ever evaluate to True, because mode is set back to RGB a few lines above?

Setting RGBA modes to RGB was introduced in #5089.

This PR just removes the check for RGBA in the last line, since it is not needed.

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.

2 participants