Closed Yay295 closed 1 month ago
What is the motivation behind this? Are these packers something that you plan on using in your own external code that uses Pillow?
It's currently possible to create or convert an image to BGR;15/16 and save it as that mode because there's a copy packer for those modes, but when those modes are removed that will no longer be possible. By adding these packers it will still be possible to save data in these formats.
I added the RGB versions because it's basically the same code with just two variables swapped.
So to demonstrate in code, your plan is for any user currently running
from PIL import Image
im = Image.new("RGB", (1, 1))
im.convert("BGR;15").tobytes()
to instead transition to running
from PIL import Image
im = Image.new("RGB", (1, 1))
im.tobytes("raw", "BGR;15")
Others should feel free to chime in with their thoughts, but I would think that the modes are being deprecated because they aren't used by any image format, and since we added our very rudimentary support for these modes, there's never been an issue from anyone using them. Because they're not used, we don't need to try and offer a workaround for this functionality when it is removed.
If you're aware of a portion of users that are using BGR;15 and BGR;16 in this way, feel free to say so.
If you've moved on and are coming up with a different plan, can this be closed?
I made these to be the opposite of the unpackers for these rawmodes, but this conversion method isn't actually roundtrippable. I know of two other methods that are roundtrippable, but I would have to change the unpackers as well for that.