mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 21:56:56 +03:00
75205f0a50
The existing 16-bit RGB rawmodes do not follow the naming convention given in Unpack.c. These new modes do follow that convention, except since these modes do not all use the same number of bits for each band, the sizes of each band are listed. Old → New 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 → ABGR;1555 BGRA;15 → ARGB;1555 BGRA;15Z → ARGB;1555Z These new rawmodes also use a slightly different conversion method. The most accurate conversion from 5 to 8 bits is "round(x * 255 / 31.0)". However, that involves floating point numbers and rounding, so it's not as fast. The current method doesn't include the rounding, allowing us to also use integer instead of floating point division. This is faster, but unfortunately not roundtrippable - when converting from 5 to 8 to 5 bits not every value stays the same. The new method is roundtrippable, even faster than the current method since it uses basic bitwise operations instead of multiplication and division, and if you compare the result to what you get with rounding and floating point numbers, it is actually more accurate. |
||
---|---|---|
.. | ||
libImaging | ||
PIL | ||
thirdparty | ||
Tk | ||
_imaging.c | ||
_imagingcms.c | ||
_imagingft.c | ||
_imagingmath.c | ||
_imagingmorph.c | ||
_imagingtk.c | ||
_webp.c | ||
decode.c | ||
display.c | ||
encode.c | ||
map.c | ||
outline.c | ||
path.c |