python-pillow / python-pillow/Pillow

Some unpackers are misnamed

Open
#8,021 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.8k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
89

Description

RGB15 actually reads data as XBGR (XBBBBBGGGGGRRRRR).

https://github.com/python-pillow/Pillow/blob/a8f434f67657d9286bafb0f132ac608276fa96c0/src/libImaging/Unpack.c#L661-L674

RGBA15 actually reads data as ABGR (ABBBBBGGGGGRRRRR).

https://github.com/python-pillow/Pillow/blob/a8f434f67657d9286bafb0f132ac608276fa96c0/src/libImaging/Unpack.c#L676-L689

RGBA4B actually reads data as ABGR (AAAABBBBGGGGRRRR).

https://github.com/python-pillow/Pillow/blob/a8f434f67657d9286bafb0f132ac608276fa96c0/src/libImaging/Unpack.c#L766-L779

etc.

Basically, all of the unpackers that read less than 8 bits per band appear to be backwards.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/libImaging/Unpack.c at lines 661-674, 676-689, and 766-779, then inspect the other unpackers that read less than 8 bits per band. Verify the channel ordering against each unpacker name and update the misnamed cases; done means the names match the formats actually read.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.