GithubHelp home page GithubHelp logo

Some unpackers are misnamed about pillow HOT 6 OPEN

Yay295 avatar Yay295 commented on July 28, 2024
Some unpackers are misnamed

from pillow.

Comments (6)

Yay295 avatar Yay295 commented on July 28, 2024

This is related to #8019, because I wrote those packers in the correct order, which is actually the opposite of the unpackers.

from pillow.

Yay295 avatar Yay295 commented on July 28, 2024

Here's the names they should be based on what they actually do and the format specified in Unpack.c.

Pillow/src/libImaging/Unpack.c

Lines 1534 to 1543 in 824db71

/* raw mode syntax is "<mode>;<bits><flags>" where "bits" defaults
depending on mode (1 for "1", 8 for "P" and "L", etc), and
"flags" should be given in alphabetical order. if both bits
and flags have their default values, the ; should be left out */
/* flags: "I" inverted data; "R" reversed bit order; "B" big
endian byte order (default is little endian); "L" line
interleave, "S" signed, "F" floating point */
/* exception: rawmodes "I" and "F" are always native endian byte order */

RGB;15 → XBGR;1555
RGB;16 → BGR;565
BGR;5 → XRGB;1555
BGR;15 → XRGB;1555
BGR;16 → RGB;565
RGB;4B → XBGR;4
RGBA;4B → ABGR;4
RGBA;15 → ARGB;1555
BGRA;15 → ABGR;1555

Unfortunately the specified format doesn't quite work because the bands in these modes aren't all the same size, so I just listed all of the sizes for those modes.

The good thing about listing out the band sizes though is that those names aren't already being used, so I could add all of them as "new" rawmodes and the old ones could be deprecated without interfering with one another.

from pillow.

radarhere avatar radarhere commented on July 28, 2024

There's a slightly awkward overlap in code that would change with this and with #7965.

from pillow.

Yay295 avatar Yay295 commented on July 28, 2024

Yes. This change would supersede both #7965 and #8019.

from pillow.

Yay295 avatar Yay295 commented on July 28, 2024

I have a branch for these changes, but it's based on #8026 because it affects the same test file.

from pillow.

radarhere avatar radarhere commented on July 28, 2024

That branch has now become #8158

from pillow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.