Skip to content

Commit 38f0830

Browse files
committed
Removed alpha_premultiplied
1 parent 10dfa63 commit 38f0830

File tree

4 files changed

+1
-28
lines changed

4 files changed

+1
-28
lines changed

Tests/test_file_avif.py

-13
Original file line numberDiff line numberDiff line change
@@ -662,19 +662,6 @@ def test_heif_raises_unidentified_image_error(self) -> None:
662662
with Image.open("Tests/images/avif/rgba10.heif"):
663663
pass
664664

665-
@pytest.mark.parametrize("alpha_premultiplied", [False, True])
666-
def test_alpha_premultiplied(
667-
self, tmp_path: Path, alpha_premultiplied: bool
668-
) -> None:
669-
temp_file = str(tmp_path / "temp.avif")
670-
color = (200, 200, 200, 1)
671-
im = Image.new("RGBA", (1, 1), color)
672-
im.save(temp_file, alpha_premultiplied=alpha_premultiplied)
673-
674-
expected = (255, 255, 255, 1) if alpha_premultiplied else color
675-
with Image.open(temp_file) as reloaded:
676-
assert reloaded.getpixel((0, 0)) == expected
677-
678665
def test_timestamp_and_duration(self, tmp_path: Path) -> None:
679666
"""
680667
Try passing a list of durations, and make sure the encoded

docs/handbook/image-file-formats.rst

-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
7171
and "tile_cols" both have their default values of zero. Requires libavif version
7272
**0.11.0** or greater.
7373

74-
**alpha_premultiplied**
75-
Encode the image with premultiplied alpha. Defaults to ``False``. Requires libavif
76-
version **0.9.0** or greater.
77-
7874
**advanced**
7975
Codec specific options. Requires libavif version **0.8.2** or greater.
8076

src/PIL/AvifImagePlugin.py

-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def _save(
164164
range_ = info.get("range", "full")
165165
tile_rows_log2 = info.get("tile_rows", 0)
166166
tile_cols_log2 = info.get("tile_cols", 0)
167-
alpha_premultiplied = bool(info.get("alpha_premultiplied", False))
168167
autotiling = bool(info.get("autotiling", tile_rows_log2 == tile_cols_log2 == 0))
169168

170169
icc_profile = info.get("icc_profile", im.info.get("icc_profile"))
@@ -214,7 +213,6 @@ def _save(
214213
range_,
215214
tile_rows_log2,
216215
tile_cols_log2,
217-
alpha_premultiplied,
218216
autotiling,
219217
icc_profile or b"",
220218
exif or b"",

src/_avif.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
241241
Py_buffer icc_buffer;
242242
Py_buffer exif_buffer;
243243
Py_buffer xmp_buffer;
244-
int alpha_premultiplied;
245244
int autotiling;
246245
int tile_rows_log2;
247246
int tile_cols_log2;
@@ -254,7 +253,7 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
254253

255254
if (!PyArg_ParseTuple(
256255
args,
257-
"(II)siiissiippy*y*iy*O",
256+
"(II)siiissiipy*y*iy*O",
258257
&width,
259258
&height,
260259
&subsampling,
@@ -265,7 +264,6 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
265264
&range,
266265
&tile_rows_log2,
267266
&tile_cols_log2,
268-
&alpha_premultiplied,
269267
&autotiling,
270268
&icc_buffer,
271269
&exif_buffer,
@@ -318,9 +316,6 @@ AvifEncoderNew(PyObject *self_, PyObject *args) {
318316
image->height = height;
319317

320318
image->depth = 8;
321-
#if AVIF_VERSION >= 90000
322-
image->alphaPremultiplied = alpha_premultiplied ? AVIF_TRUE : AVIF_FALSE;
323-
#endif
324319

325320
encoder = avifEncoderCreate();
326321
if (!encoder) {
@@ -537,9 +532,6 @@ _encoder_add(AvifEncoderObject *self, PyObject *args) {
537532
frame->yuvRange = image->yuvRange;
538533
frame->yuvFormat = image->yuvFormat;
539534
frame->depth = image->depth;
540-
#if AVIF_VERSION >= 90000
541-
frame->alphaPremultiplied = image->alphaPremultiplied;
542-
#endif
543535
}
544536

545537
avifRGBImageSetDefaults(&rgb, frame);

0 commit comments

Comments
 (0)