Skip to content

PIL doesn't seem to handle the color map correctly in some color indexed TGA files #4830

@innovara

Description

@innovara

Please see my question in Stack Overflow where I explain everything in greater detail and more importantly, where Mark Setchell explains why he thinks there is a bug in PIL when handling some color indexed TGA files.

Basically, I am working with a sample color indexed TGA file to test a script that would invert its colors.

But before any of that, the issue is that PIL doesn't seem to handle the color map correctly when open it and the values of the color palette end up being wrong.

These are the sample files: CCM8.TGA and UCM8.TGA.
And you will see that if you open show any of them:

from PIL import Image
Image.open('CCM8.TGA').show()

PIL shows:
pQ6IH
When it should be:
IpPCy

As I said, I wrote all the details on that post. If you want me to submit more information here, please let me know.

I am using Pillow 7.0 on Fedora 32 and Python 3.8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions