Commit Graph

4436 Commits

Author SHA1 Message Date
Kylian Ronfleux--Corail
13bffef91d Fix quantization table scaling when quality is applied to custom qtables
When both a custom quantization table and a quality value are provided,
the quantization table should be scaled using the JPEG quality scaling factor.
If quality is not explicitly set, the default base quality of 50 is used to preserve the original table.
This ensures consistent behavior when saving JPEGs with custom qtables.

Fixes part of the issue with applying 'quality' to 'qtables'.
2025-04-10 10:01:02 +00:00
Kylian Ronfleux--Corail
e3c0ee6ae2 Fix incorrect quality scaling when using qtables in JPEG encoder
When both `qtables` and `quality` are provided, Pillow previously passed
the raw `quality` value directly to `jpeg_add_quant_table()` as the scale
factor, which caused incorrect quantization.

This commit corrects the behavior by using `jpeg_quality_scaling(quality)`
to compute the proper JPEG quantization scaling factor, consistent with
`jpeg_set_quality()`.

This ensures expected compression behavior when custom qtables are used
alongside a specified quality level.
2025-04-10 07:31:05 +00:00
Hugo van Kemenade
8c4510cb23 Fix clang-format: Configuration file(s) do(es) not support C 2025-04-07 22:25:12 +03:00
pre-commit-ci[bot]
a5a8ece5d2 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-04-07 17:17:36 +00:00
Frankie Dintino
9f654ff748
Fixed conversion of AVIF image rotation property to EXIF orientation (#8866) 2025-04-04 16:41:11 +03:00
Andrew Murray
9f4195752d
Added type hints (#8867) 2025-04-03 13:24:37 +03:00
Andrew Murray
2d452c82e5
Removed condition that is always true (#8862) 2025-04-03 13:17:54 +03:00
Andrew Murray
8dbbce624f Compare absolute path of filename 2025-04-02 12:16:25 +11:00
Andrew Murray
1103e82d17 Include filename in state 2025-04-02 11:14:58 +11:00
mergify[bot]
7c56b383ff
Merge pull request #8842 from AdianKozlica/image_grab_wayland_kde
Add KDE Wayland support for ImageGrab
2025-04-01 09:38:56 +00:00
mergify[bot]
64178415e6
Merge pull request #8852 from radarhere/save
Only change readonly if saved filename matches opened filename
2025-04-01 09:22:14 +00:00
Andrew Murray
98e74fd7a0
Merge pull request #8516 from radarhere/imagegrab
Allow HWND to be passed to ImageGrab.grab() on Windows
2025-04-01 18:45:03 +11:00
Adian Kozlica
2b62c0beeb
Merge branch 'main' into image_grab_wayland_kde 2025-04-01 09:43:52 +02:00
Andrew Murray
a7537b1b06 Only change readonly if saved filename matches opened filename 2025-04-01 18:31:04 +11:00
wiredfool
5c76e7ec17
Image -> Arrow support (#8330)
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-01 09:10:45 +03:00
Frankie Dintino
7d50816f0a
Add AVIF plugin (decoder + encoder using libavif) (#5201)
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-01 07:13:21 +03:00
Andrew Murray
f673f3e543
Close file handle on error (#8846) 2025-03-30 21:16:50 +03:00
Andrew Murray
4236b583a1 Do not import TYPE_CHECKING 2025-03-30 22:16:16 +11:00
pre-commit-ci[bot]
d2683e052f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-03-30 11:13:51 +00:00
Andrew Murray
80d5b421eb
Do not import type checking
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-03-30 22:13:21 +11:00
Andrew Murray
ca9f4f8304
Merge branch 'main' into imagegrab 2025-03-30 21:53:23 +11:00
Adian Kozlica
ec11f7aaed
Merge branch 'main' into image_grab_wayland_kde 2025-03-29 23:51:29 +01:00
Andrew Murray
bce83ac800
Enable mmap on PyPy (#8840) 2025-03-29 18:36:36 +02:00
Andrew Murray
25653d2f87
Corrected P mode save (#8685) 2025-03-29 18:34:42 +02:00
Andrew Murray
e8a9b56603
Improved connecting discontiguous corners (#8659) 2025-03-29 18:33:51 +02:00
Andrew Murray
03dc994baa
Check that _fp type is not DeferredError before use (#8640) 2025-03-29 18:30:30 +02:00
Andrew Murray
6bffa3a9d4
Only read until the offset of the next tile (#8609)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2025-03-29 18:29:02 +02:00
Andrew Murray
140e426082
Added USE_RAW_ALPHA (#8602)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2025-03-29 18:27:00 +02:00
Andrew Murray
93cdfeb488
Prevent TIFFRGBAImageBegin from applying image orientation (#8556)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2025-03-29 18:25:57 +02:00
Andrew Murray
6d42449788
Allow loading of EMF images at a given DPI (#8536)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2025-03-29 18:25:13 +02:00
Hugo van Kemenade
2579973815
Merge pull request #8506 from radarhere/emf_records
Skip failing records when rendering WMF images
2025-03-29 18:19:10 +02:00
Andrew Murray
e685e2833e Do not create temporary file if no utility is available 2025-03-29 18:27:02 +11:00
Adian Kozlica
eeb494abf7 Fix formatting 2025-03-28 17:18:09 +01:00
Adian Kozlica
722283e819 Add KDE Wayland support for ImageGrab 2025-03-28 16:43:10 +01:00
Andrew Murray
10ccbd7788
If append_images is populated, default save_all to True (#8781)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2025-03-27 18:01:09 +02:00
Hugo van Kemenade
095f5992bc
Merge pull request #8826 from radarhere/gimp
Added GimpPaletteFile frombytes() to allow for unlimited parsing
2025-03-27 14:47:29 +02:00
Andrew Murray
3c185d1f69
Do not load image during save if file extension is unknown (#8835)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
2025-03-27 14:44:27 +02:00
Andrew Murray
295a5e9bd7 Do not convert BC1 LUT to UINT32 2025-03-27 21:36:17 +11:00
Andrew Murray
510bc05577 Added frombytes() to allow for unlimited parsing 2025-03-20 23:12:35 +11:00
Andrew Murray
0888dc02ac Allow for two header fields and a comment 2025-03-20 23:10:09 +11:00
Andrew Murray
acd8548f6e Removed FIXME 2025-03-20 22:36:59 +11:00
Andrew Murray
ba2c4291ea Updated comment 2025-03-19 19:22:15 +11:00
Hugo van Kemenade
e1bf0f647f
Merge pull request #8805 from radarhere/gimp
Start from zero index when reading GimpPaletteFile
2025-03-18 15:32:24 +02:00
Hugo van Kemenade
74fec91d33
Merge pull request #8807 from radarhere/dxt1
Support saving DDS images with pixel formats
2025-03-18 15:31:38 +02:00
Andrew Murray
841ba163fd If every tile covers the image, only use the last offset 2025-03-18 00:21:08 +11:00
Andrew Murray
cd11792c15 Added BC5 saving 2025-03-17 07:55:25 +11:00
Andrew Murray
b0315cc603 Added BC2 loading and saving 2025-03-17 07:55:24 +11:00
Andrew Murray
f1a61a1e76 Added DXT3 saving 2025-03-17 07:55:24 +11:00
Andrew Murray
9f619b814f Added BC3 loading and saving 2025-03-17 07:55:24 +11:00
Andrew Murray
9430bbe5a1 Added DXT5 saving 2025-03-17 07:55:24 +11:00