Skip to content

"illegal image mode" when trying to subtract a png from another by using putalpha #7295

Answered by radarhere
Nicolas-Gth asked this question in Q&A
Discussion options

You must be logged in to vote

I think you've correctly understood that the alpha argument to putalpha() "can either be an “L” or “1” image"

However, what I think you've missed is that convert() "Returns a converted copy of this image". A copy. It does not modify the original. The same goes for resize().

So I would suggest just changing

substractShapeBackGround.convert('L').resize(reflexionBackground.size)

to

substractShapeBackGround = substractShapeBackGround.convert('L').resize(reflexionBackground.size)

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Nicolas-Gth
Comment options

@radarhere
Comment options

@Nicolas-Gth
Comment options

@radarhere
Comment options

@Nicolas-Gth
Comment options

Answer selected by radarhere
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants