Commit Graph

4114 Commits

Author SHA1 Message Date
Yay295
ad7ecd4680 add check for deprecated rawmodes when creating an ImagePalette 2024-09-18 14:43:41 -05:00
Yay295
2c4df4efd8 don't show rawmode deprecation warning if mode is same as rawmode
The "BGR;15" and "BGR;16" modes being deprecated is separate from the "BGR;15" and "BGR;16" rawmodes being deprecated.
2024-09-18 14:43:40 -05:00
Yay295
954def2938 deprecate old rawmodes for 16-bit RGB data 2024-09-18 14:43:40 -05:00
Yay295
8b719e9401 use new rawmodes in BMP and TGA image plugins 2024-09-18 14:43:40 -05:00
Yay295
a43e1f8118 clean up rawmode syntax comments 2024-09-18 14:43:39 -05:00
Yay295
75205f0a50 add "new" rawmodes for 16-bit RGB data
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.
2024-09-18 14:43:39 -05:00
Hugo van Kemenade
1ee3bd1d9e
Merge pull request #8390 from radarhere/tiff_exif_transpose
Use transposed size after opening for TIFF images
2024-09-18 22:35:01 +03:00
Hugo van Kemenade
743ddc7a58
Merge pull request #8338 from yngvem/improve-error-messages 2024-09-18 18:22:04 +03:00
Andrew Murray
9adb476f37
Rearranged text 2024-09-18 23:58:23 +10:00
Andrew Murray
629f5be52e In seek(), create core image at size needed for loading 2024-09-18 22:56:29 +10:00
Andrew Murray
a92dca66bd Use raw size for striped tiles 2024-09-18 21:22:59 +10:00
Andrew Murray
a859695d9a
Rearranged code
Co-authored-by: Alexander Karpinsky <homm86@gmail.com>
2024-09-18 21:17:49 +10:00
Andrew Murray
9135fd0fb2 Mention limit in error message 2024-09-18 20:56:55 +10:00
Andrew Murray
84e275d906 Loading does not change mode 2024-09-18 20:27:35 +10:00
Andrew Murray
f1e86965f6 Use transposed size after opening for TIFF images 2024-09-18 20:26:06 +10:00
Andrew Murray
8a086edbe9 Cast handle to int 2024-09-16 08:23:26 +10:00
Andrew Murray
1557f7e36f Removed unused variable 2024-09-13 23:41:47 +10:00
Hugo van Kemenade
575f574f5c
Merge pull request #8369 from radarhere/stroke_width_float 2024-09-12 08:53:41 +03:00
Yngve Mardal Moe
9ba4e10a16
Merge branch 'main' into improve-error-messages 2024-09-11 17:11:52 +02:00
Yngve Mardal Moe
32c514d24c
Update src/PIL/ImageFont.py
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2024-09-11 14:54:53 +02:00
Yngve Mardal Moe
77503156b1
Update src/PIL/ImageFont.py
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-11 14:22:45 +02:00
Aleksandr Karpinskii
4a284a78c5 Remove weird comments 2024-09-11 20:40:46 +10:00
Andrew Murray
01ba1e2252 Accept float stroke widths 2024-09-11 19:53:52 +10:00
pre-commit-ci[bot]
e4f13020e1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-09-11 08:33:12 +00:00
Yngve Mardal Moe
d2efd7dd5f
Update src/PIL/ImageFont.py
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2024-09-11 10:32:42 +02:00
Hugo van Kemenade
e91aedb65d
Merge pull request #8352 from radarhere/scale 2024-09-10 14:38:33 +03:00
Hugo van Kemenade
302b63f1c3
Merge pull request #8366 from radarhere/gif_rgba 2024-09-10 14:37:03 +03:00
Andrew Murray
5cb736d953
Merge branch 'main' into scale 2024-09-10 20:39:04 +10:00
Andrew Murray
d522e0a5c0 Improved handling of RGBA palettes when saving GIF images 2024-09-10 18:50:06 +10:00
Andrew Murray
adb6918214 Use isinstance to detect Image instances 2024-09-10 16:20:58 +10:00
Andrew Murray
e0845f06d8 Deprecate isImageType 2024-09-10 16:20:52 +10:00
Hugo van Kemenade
452b445d4f
Merge pull request #8358 from radarhere/lab 2024-09-09 08:20:29 +03:00
Andrew Murray
63f398bc12
Merge pull request #8194 from uploadcare/optimize-getbbox
Optimize getbbox() and getextrema() routines
2024-09-09 15:08:11 +10:00
Andrew Murray
a3c7912b98
Merge branch 'main' into scale 2024-09-09 13:22:10 +10:00
Andrew Murray
906f93275e
Merge pull request #8356 from hugovk/deprecate-freetype-2.9.0
Deprecate support for FreeType 2.9.0
2024-09-09 13:18:13 +10:00
Hugo van Kemenade
f30eefaae2
Merge pull request #8354 from radarhere/type_hint 2024-09-08 16:19:08 +03:00
Andrew Murray
579a5a2ed1
Merge pull request #8355 from radarhere/unused_tiff
Removed unused TiffImagePlugin IFD_LEGACY_API
2024-09-08 21:36:44 +10:00
Andrew Murray
8b3ef3784b Moved Buffer into _typing 2024-09-08 08:30:30 +10:00
Hugo van Kemenade
f06b851616
Merge pull request #8350 from zakajd/jamil/doubleexif 2024-09-07 12:31:19 +03:00
Andrew Murray
dbe979d032 Sort extensions alphabetically in error message 2024-09-07 19:09:01 +10:00
Andrew Murray
e14072e973 Added further detail 2024-09-07 19:08:07 +10:00
Hugo van Kemenade
a838da7406
Merge pull request #8002 from Yay295/patch-1
Use (void) for empty function parameters
2024-09-07 08:37:50 +03:00
Andrew Murray
a6ca45aea6 Use (void) to indicate no parameters 2024-09-07 00:01:25 -05:00
Andrew Murray
de3c6fa295 Support converting more modes to LAB by converting to RGBA first 2024-09-07 12:14:30 +10:00
Jamil Zakirov
2f25dbce06
Merge branch 'main' into jamil/doubleexif 2024-09-06 20:12:33 +03:00
Hugo van Kemenade
d3c1d99d00 Deprecate support for FreeType 2.9.0 2024-09-06 14:51:30 +03:00
Andrew Murray
93a0bf0276 Added type hints to TiffImagePlugin _save 2024-09-06 21:33:30 +10:00
Andrew Murray
94315f87c3 Removed unused IFD_LEGACY_API 2024-09-06 19:13:35 +10:00
Andrew Murray
06c331af5d Added type hints to frombuffer 2024-09-06 15:16:59 +10:00
Andrew Murray
23c461e431 Handle duplicate exif header
Co-authored-by: Jamil Zakirov <djamilzak@gmail.com>
2024-09-06 11:56:06 +10:00