Skip to content

Fixed converting indexed PIL images to numpy#2881

Merged
joeyballentine merged 1 commit intochaiNNer-org:mainfrom
RunDevelopment:issue2620
May 19, 2024
Merged

Fixed converting indexed PIL images to numpy#2881
joeyballentine merged 1 commit intochaiNNer-org:mainfrom
RunDevelopment:issue2620

Conversation

@RunDevelopment
Copy link
Member

Fixes #2816
Fixes #2620

Turns out, when the internet tells you how to convert a PIL image to numpy, they are lying to you. When the PIL image in question uses a color palette (mode=P), then np.array(im) will give you the indexes into the color palette and not the colors. So we have to convert the image first.

@RunDevelopment RunDevelopment changed the title Fixed converting indexed PIL to numpy Fixed converting indexed PIL images to numpy May 19, 2024
@joeyballentine joeyballentine merged commit a9c6e50 into chaiNNer-org:main May 19, 2024
@RunDevelopment RunDevelopment deleted the issue2620 branch May 19, 2024 16:20
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.

Indexed Color .tga Files Treated as Grayscale Support for Indexed Color images

2 participants