Commit Graph

611 Commits

Author SHA1 Message Date
Hugo van Kemenade
a596a4063d
Merge pull request #8112 from radarhere/i16_mask 2024-06-25 06:50:47 -06:00
Hugo van Kemenade
bbf879641d
Merge pull request #7997 from radarhere/rgbx 2024-06-25 05:28:50 -06:00
Andrew Murray
08b5a2e9a7 Corrected using a 1 mode mask with I;16* images 2024-06-08 14:35:10 +10:00
Andrew Murray
82910a5e4f Lint fixes 2024-05-19 22:00:45 +10:00
Andrew Murray
22b64ffcf2
Merge pull request #8015 from hugovk/pre-commit-clang
Add ClangFormat to pre-commit
2024-05-19 16:27:30 +10:00
Andrew Murray
3062ec4dd2 Fix type errors 2024-05-16 22:55:03 +10:00
Andrew Murray
7d62c306cc
Merge branch 'main' into pre-commit-clang 2024-04-30 21:34:41 +10:00
Andrew Murray
996c053d89 Change comment style 2024-04-28 22:49:56 +10:00
Hugo van Kemenade
5597f618a3
Change comment style
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2024-04-28 02:49:42 -06:00
Andrew Murray
fd8c6a6295 Do not indent goto labels 2024-04-28 13:51:32 +10:00
Hugo van Kemenade
1138ea5370
Merge pull request #7921 from Yay295/testing
Fix ImagingAccess for I;16N on big-endian
2024-04-25 21:36:38 +03:00
pre-commit-ci[bot]
617e7295a8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-04-25 12:51:24 +00:00
Hugo van Kemenade
1fc1179ed5
Merge pull request #8008 from radarhere/convert
Simplified RGB to I;16, I;16L and I;16B conversion
2024-04-25 00:00:15 +03:00
Andrew Murray
46b85e6ab4 Simplified code 2024-04-24 11:02:56 +10:00
Yay295
eee53ba664
extract band count check 2024-04-23 13:06:22 -05:00
Andrew Murray
bb2411dd01 Support reading P mode TIFF images with padding 2024-04-22 08:11:45 +10:00
Andrew Murray
98a0515494 Read images as RGB, rather than RGBX 2024-04-22 08:05:59 +10:00
Yay295
da7198c987 fix ImagingAccess for I;16N on big-endian 2024-04-20 09:01:38 -05:00
Andrew Murray
22705d3da5
Merge pull request #7956 from Cirras/obscure-bitmap-headers
Add support for reading `BITMAPV2INFOHEADER` and `BITMAPV3INFOHEADER`
2024-04-13 16:25:26 +10:00
Yay295
82b7b8a9ee
Fix some comments 2024-04-11 00:29:31 -05:00
Andrew Murray
98ae91a65d Added BGXR and BGAR unpackers 2024-04-09 00:45:48 +10:00
Andrew Murray
c61a481028 Support reading CMYK JPEG2000 images 2024-04-06 13:40:39 +11:00
Hugo van Kemenade
7b2320b50f Fix typos 2024-03-31 15:57:20 +03:00
Andrew Murray
838bb6c493 Added RGB to I;16N conversion 2024-03-30 20:22:50 +11:00
Andrew Murray
fb6b860172 Added RGB to I;16, I;16L and I;16B conversion 2024-03-30 11:33:55 +11:00
Hugo van Kemenade
d734c8b702
Merge pull request #7888 from radarhere/convert_rgb 2024-03-28 18:11:12 +02:00
Andrew Murray
e79d1746f2 Support conversion from RGB to La 2024-03-26 19:57:17 +11:00
Andrew Murray
ab8f465f1a Use transparency info when converting from RGB to LA 2024-03-26 19:55:22 +11:00
Andrew Murray
171e497e05 Raise ValueError if kmeans is negative 2024-03-22 17:36:04 +11:00
Andrew Murray
8b6a182815 Support conversion from RGB to RGBa 2024-03-21 16:25:40 +11:00
Andrew Murray
f128d47e15 Added reading of JPEG2000 palettes 2024-03-12 19:30:23 +11:00
Richard Barnes
38cec87c93
Fix shift-sign issue in Convert.c (#7838)
* Fix shift-sign issue in Convert.c

Fixes
```
libImaging/Convert.c:513:25: error: signed shift result (0xFF000000) sets the sign bit of the shift expression's type ('int') and becomes negative [-Werror,-Wshift-sign-overflow]
    UINT32 trns = (0xff << 24) | ((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xff);
                   ~~~~ ^  ~~
```

---------

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2024-03-09 17:52:00 +11:00
Andrew Murray
d6a3f89e27 Open 16-bit grayscale PNGs as I;16 2024-03-02 15:39:43 +11:00
Andrew Murray
2d6ad5868d Use "non-zero" consistently 2024-01-06 12:07:55 +11:00
Benjamin Gilbert
a5fab5fc0b Fail if chroma subsampling selected when writing RGB JPEG
The user presumably doesn't intend to subsample the green and blue
channels.
2023-12-26 12:37:35 -06:00
Benjamin Gilbert
4b422db243 Add keep_rgb option to prevent RGB -> YCbCr conversion during JPEG write
libjpeg automatically converts RGB to YCbCr by default.  Add a keep_rgb
option to disable libjpeg's automatic conversion of RGB images during
write.
2023-12-13 18:26:35 -06:00
Andrew Murray
4b308dc2bf
Merge pull request #7488 from bgilbert/jpeg-restart
Allow configuring JPEG restart marker interval on save
2023-11-14 23:42:50 +11:00
Hugo van Kemenade
556dd1e15c
Merge pull request #7535 from hugovk/add-3.13 2023-11-12 00:34:12 +02:00
Hugo van Kemenade
9b88cf5ad9 #ifdef _UNISTD_H -> HAVE_UNISTD_H 2023-11-08 18:48:40 +02:00
Hugo van Kemenade
95eef25aca Fix for Python 3.13: explicitly include unistd.h 2023-11-08 17:52:43 +02:00
Benjamin Gilbert
e572722479 Allow configuring JPEG restart marker interval on save
libjpeg allows specifying the marker interval either in MCU blocks or in
MCU rows.  Support both, via separate parameters, rather than requiring
callers to do the math.

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2023-10-31 17:47:25 -05:00
Benjamin Gilbert
4d7372bfd0 Implement streamtype=1 option for tables-only JPEG encoding
We already support streamtype=2 to skip producing JPEG tables, but
streamtype=1, which skips everything but the tables, was never implemented.
The streamtype=1 stub code dates to Git pre-history, so it's not
immediately clear why.  Implement the missing support.

jpeg_write_tables() can't resume after a full output buffer (it fails with
JERR_CANT_SUSPEND), so it might seem that Pillow needs to pre-compute the
necessary buffer size.  However, in the normal case of producing an
interchange stream, the tables are written via the same libjpeg codepath
during the first jpeg_write_scanlines() call, and table writes aren't
resumable there either.  Thus, any buffer large enough for the normal case
will also be large enough for a tables-only file.

The streamtype option isn't documented and this commit doesn't change that.
It does add a test though.

Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2023-10-24 20:30:45 -05:00
Andrew Murray
d682c18ded Use "gray" more consistently 2023-10-19 19:12:01 +11:00
Andrew Murray
4e7f61f459
Merge branch 'main' into bgr 2023-10-06 18:50:25 +11:00
Andrew Murray
b8c30655cc Include CMYK to RGB convert as unpacker 2023-10-06 16:05:03 +11:00
Andrew Murray
787daa9f19 Merge branch 'main' into cmyk2rgb 2023-10-06 15:52:32 +11:00
Hugo van Kemenade
6f73691564
Merge pull request #7257 from radarhere/i16_point 2023-10-05 12:54:25 -06:00
Hugo van Kemenade
09605ff48e
Merge pull request #7413 from radarhere/bc5s 2023-10-05 09:48:12 -06:00
Hugo van Kemenade
5f04b3d278
Merge pull request #7289 from radarhere/undefined_palette 2023-10-05 09:31:02 -06:00
Hugo van Kemenade
f76b63d016 Add end-of-file-fixer to pre-commit 2023-09-25 16:45:38 +03:00
Andrew Murray
352bcaac74 Set blue channel to 128 for BC5S 2023-09-21 16:38:45 +10:00
Andrew Murray
e57b08affd Move strcmp outside of while loops 2023-09-21 16:38:19 +10:00
Andrew Murray
96e3534034 Corrected converting signed values to unsigned in BC5S 2023-09-16 13:53:10 +10:00
Andrew Murray
9f54a11a9c Improve efficiency when a radius is zero 2023-08-12 18:17:07 +10:00
Andrew Murray
c167d7a269 Allow GaussianBlur and BoxBlur to accept a sequence of x and y radii 2023-08-12 12:09:20 +10:00
Hugo van Kemenade
95257dff87
Merge pull request #7299 from radarhere/pdf 2023-08-04 11:43:09 +03:00
Andrew Murray
00cec60c35 Added CMYK to RGB unpacker 2023-07-29 21:05:33 +10:00
Andrew Murray
5fa05623ff Added BGR;15, BGR;16 and BGR;24 unpacking 2023-07-26 20:09:40 +10:00
Andrew Murray
3230270aa7 Added BGR;15, BGR;16 and BGR;24 access 2023-07-26 20:09:40 +10:00
Andrew Murray
c108d9ddb0 Set alpha channel when saving LA in OpenJPEG 2023-07-22 20:05:31 +10:00
Andrew Murray
577a4d8bf8 Change get_pixel to be specific to images with 2 bands 2023-07-21 21:08:20 +10:00
Andrew Murray
7ffad80294 Removed put_pixel 2023-07-21 20:59:28 +10:00
Andrew Murray
32eec53c43 Removed comment 2023-07-17 23:50:59 +10:00
Andrew Murray
fd310512b9 Set C palette to be empty by default 2023-07-17 23:04:43 +10:00
Andrew Murray
ba9c830b03 Corrected writing I;16 text 2023-07-08 11:30:48 +10:00
Andrew Murray
5e2332a200 Corrected drawing I;16 points 2023-07-05 08:49:56 +10:00
Hugo van Kemenade
0ac3677b56
Merge pull request #7199 from radarhere/tiff_close 2023-06-30 09:27:26 +03:00
Hugo van Kemenade
be4bfaac9e
Merge pull request #7123 from radarhere/apng 2023-06-30 09:24:20 +03:00
Andrew Murray
45c9dcf123 Restored 32-bit support 2023-06-27 14:43:58 +10:00
Hugo van Kemenade
190c53a1b1
Merge pull request #7228 from radarhere/32bit
Removed support for 32-bit
2023-06-24 19:02:00 +03:00
Andrew Murray
d6f19625e8 Removed support for 32-bit 2023-06-23 21:52:00 +10:00
Andrew Murray
17b19b5668 Merge branch 'main' into apng 2023-06-14 11:26:42 +10:00
Andrew Murray
68edbbca94 Merge branch 'main' into int_def 2023-06-14 09:11:41 +10:00
Hugo van Kemenade
c62c514299
Merge pull request #7187 from radarhere/putpalette 2023-06-13 20:10:33 +03:00
Hugo van Kemenade
9d08c8247d
Merge pull request #7180 from radarhere/int64 2023-06-13 20:08:26 +03:00
Andrew Murray
aeb6e9909e Removed unused argument 2023-06-10 15:57:05 +10:00
Andrew Murray
748a4d0fcd Removed unused variable 2023-06-10 14:26:28 +10:00
Andrew Murray
15edb6d625 Fixed signedness comparison warning 2023-06-07 22:33:55 +10:00
Andrew Murray
0835be95cb Added comment 2023-06-05 15:07:11 +10:00
Andrew Murray
e45da2ae17 Do not close provided file handles with libtiff 2023-06-05 11:07:09 +10:00
Andrew Murray
07eccd9798 Fixed calling putpalette() on L and LA images before load() 2023-05-28 06:44:34 +10:00
Andrew Murray
b8719033ca Removed unused INT64 definition 2023-05-23 22:53:16 +10:00
Yay295
f6b516bb06 Adjust C preprocessor block labels
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-05-19 08:11:39 -05:00
Yay295
724f266460 change INT16 def failure to an error 2023-05-18 17:49:13 -05:00
Yay295
9da0b58eea move INT8 def to top 2023-05-18 17:49:13 -05:00
Yay295
fbec8f19dd add check for C99+ to use their defs if possible 2023-05-18 17:49:13 -05:00
Yay295
c2527348ec add comment explaining why #define and not typedef 2023-05-18 17:49:13 -05:00
Yay295
e9cfe4b6a2 label preprocessor if..else..endif for clarity 2023-05-18 17:49:13 -05:00
Yay295
6de5e999bd add UINT64 def if INT64 is defined 2023-05-18 17:49:12 -05:00
Yay295
509671c53e fix INT64 def and add warning if not set 2023-05-18 17:49:12 -05:00
Hugo van Kemenade
74a851965c
Merge pull request #7108 from radarhere/filter 2023-05-03 18:18:53 +03:00
Andrew Murray
ff003bfbcc Added unpacker from I;16B to I;16 2023-04-30 14:49:40 +10:00
Andrew Murray
96bdbc4afe Renamed variable 2023-04-29 19:11:02 +10:00
Andrew Murray
ebd3c47425 When saving, allow alpha differences to indicate different frames 2023-04-29 15:02:11 +10:00
Andrew Murray
d0b41da094 Support I mode for BuiltinFilter 2023-04-22 21:22:01 +10:00
Andrew Murray
57bbe6df2c Remove use of deprecated "bpp" member 2023-04-16 23:16:01 +10:00
Andrew Murray
89d2cdfcfa Fixed warning that nLeft is set but not used 2023-03-31 22:30:36 +11:00
Andrew Murray
f8be09612d
Merge pull request #6903 from joshware/jp2k_options
Support custom comments and PLT markers when saving JPEG2000 images
2023-03-29 23:43:54 +11:00
Andrew Murray
2f66d2d6a1 Changed maximum comment length to 65531 2023-03-29 19:25:35 +11:00
Andrew Murray
1fd189164c Renamed "add_plt" to "plt" 2023-03-27 22:38:29 +11:00