From 54b566cf479eef8b6649d3be777c2ce3a005b7a6 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Mon, 2 Feb 2026 19:27:25 +0100 Subject: [PATCH 1/5] Add .pil() method --- doc/intro.rst | 7 +- examples/generate_type_stubs.py | 8 +- pyvips/__init__.pyi | 8 +- pyvips/vimage.py | 52 +++++++++ tests/test_image.py | 184 ++++++++++++++++++++++++++++++++ 5 files changed, 252 insertions(+), 7 deletions(-) diff --git a/doc/intro.rst b/doc/intro.rst index fe8effc..8c33c74 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -154,13 +154,11 @@ many image formats:: assert np.array_equal(a1, a2) -The :meth:`PIL.Image.fromarray` method can be used to convert a pyvips image -to a PIL image via a NumPy array:: +Use :meth:`.pil` to convert a pyvips image to a PIL image:: import pyvips - import PIL.Image image = pyvips.Image.black(100, 100, bands=3) - pil_image = PIL.Image.fromarray(image.numpy()) + pil_image = image.pil() Calling libvips operations @@ -415,4 +413,3 @@ where possible, so you won't have 100 copies in memory. If you want to avoid the copies, you'll need to call drawing operations yourself. - diff --git a/examples/generate_type_stubs.py b/examples/generate_type_stubs.py index cac0d94..3986585 100755 --- a/examples/generate_type_stubs.py +++ b/examples/generate_type_stubs.py @@ -323,7 +323,12 @@ def generate_stub() -> str: """ from __future__ import annotations -from typing import Dict, List, Optional, Tuple, TypeVar, Union, overload +from typing import Dict, List, Optional, Tuple, TypeVar, Union, overload, TYPE_CHECKING + +if TYPE_CHECKING: + from PIL.Image import Image as PILImage # type: ignore +else: + class PILImage: ... # Exception classes class Error(Exception): ... @@ -441,6 +446,7 @@ def tolist(self) -> List[List[float]]: ... # numpy is optional dependency - use TYPE_CHECKING guard def __array__(self, dtype: Optional[str] = None, copy: Optional[bool] = None) -> object: ... def numpy(self, dtype: Optional[str] = None) -> object: ... + def pil(self) -> PILImage: ... # Hand-written bindings with type hints def floor(self) -> Image: ... diff --git a/pyvips/__init__.pyi b/pyvips/__init__.pyi index bc30b92..b768605 100644 --- a/pyvips/__init__.pyi +++ b/pyvips/__init__.pyi @@ -16,7 +16,12 @@ To regenerate after libvips updates: """ from __future__ import annotations -from typing import Dict, List, Optional, Tuple, TypeVar, Union, overload +from typing import Dict, List, Optional, Tuple, TypeVar, Union, overload, TYPE_CHECKING + +if TYPE_CHECKING: + from PIL.Image import Image as PILImage # type: ignore +else: + class PILImage: ... # Exception classes class Error(Exception): ... @@ -184,6 +189,7 @@ class Image(VipsObject): # numpy is optional dependency - use TYPE_CHECKING guard def __array__(self, dtype: Optional[str] = None, copy: Optional[bool] = None) -> object: ... def numpy(self, dtype: Optional[str] = None) -> object: ... + def pil(self) -> PILImage: ... # Hand-written bindings with type hints def floor(self) -> Image: ... diff --git a/pyvips/vimage.py b/pyvips/vimage.py index f91df3a..f9cc9b7 100644 --- a/pyvips/vimage.py +++ b/pyvips/vimage.py @@ -1,7 +1,9 @@ # wrap VipsImage +import array import numbers import struct +import sys import pyvips from pyvips import ffi, glib_lib, vips_lib, Error, _to_bytes, \ @@ -1279,6 +1281,56 @@ def numpy(self, dtype=None): """ return self.__array__(dtype=dtype) + def pil(self): + """Convert the image to a PIL Image. + + This uses :meth:`PIL.Image.fromarray` for most formats and falls back + to raw-mode conversion for formats not natively supported by that method. + + Notes: + + - Pillow stores RGB/RGBA data as 8-bit, so 16-bit inputs will be + converted by keeping the high byte of each channel. + - Pillow expands LA inputs to RGBA by duplicating the L channel into RGB. + + PIL is a runtime dependency of this function. + """ + try: + from PIL import Image as PILImage + except ImportError as err: + raise ImportError('PIL not available') from err + + if self.bands == 1 or self.format != 'ushort': + return PILImage.fromarray(self.numpy()) + + data = self.write_to_memory() + + if self.bands == 2: + mode = 'RGBA' + rawmode = 'LA;16B' + # Pillow only accepts LA;16B. Byteswap on little-endian systems. + if sys.byteorder == 'little': + swapped = array.array('H') + swapped.frombytes(data) + swapped.byteswap() + data = swapped.tobytes() + elif self.bands == 3: + mode = 'RGB' + rawmode = 'RGB;16L' if sys.byteorder == 'little' else 'RGB;16B' + elif self.bands == 4: + mode = 'RGBA' + rawmode = 'RGBA;16L' if sys.byteorder == 'little' else 'RGBA;16B' + else: + raise ValueError('PIL does not support 16-bit images with more than 4 bands') + + return PILImage.frombytes( + mode, + (self.width, self.height), + data, + 'raw', + rawmode + ) + def __repr__(self): if ( self.interpretation == "matrix" diff --git a/tests/test_image.py b/tests/test_image.py index 023ca1a..e2a15ea 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -1,5 +1,8 @@ # vim: set fileencoding=utf-8 : +import struct +import sys + import pyvips import pytest from helpers import JPEG_FILE, UHDR_FILE, skip_if_no @@ -394,6 +397,187 @@ def test_from_PIL(self): assert im.min() == 0 assert im.max() == 0 + def test_to_PIL_16bit(self): + try: + import PIL.Image + except ImportError: + pytest.skip('PIL not available') + + endian = '<' if sys.byteorder == 'little' else '>' + data = struct.pack( + f'{endian}6H', + 0x1234, + 0x5678, + 0x9ABC, + 0xDEF0, + 0x1111, + 0x2222 + ) + im = pyvips.Image.new_from_memory(data, 2, 1, 3, 'ushort') + + try: + import numpy as np + except ImportError: + np = None + + if np is not None: + with pytest.raises(TypeError): + PIL.Image.fromarray(im.numpy()) + + pim = im.pil() + assert pim.mode == 'RGB' + assert pim.size == (2, 1) + assert pim.getpixel((0, 0)) == (0x12, 0x56, 0x9A) + assert pim.getpixel((1, 0)) == (0xDE, 0x11, 0x22) + + def test_to_PIL_16bit_rawmode_rgb_rgba(self, monkeypatch): + try: + import PIL.Image as PILImage + except ImportError: + pytest.skip('PIL not available') + + seen = [] + + def fake_frombytes(mode, size, data, decoder_name, rawmode): + seen.append((mode, rawmode)) + return PILImage.new(mode, size) + + monkeypatch.setattr(PILImage, "frombytes", fake_frombytes) + + data = struct.pack('6H', 0x1234, 0x5678, 0x9ABC, 0xDEF0, 0x1111, 0x2222) + im = pyvips.Image.new_from_memory(data, 2, 1, 3, 'ushort') + im.pil() + + data = struct.pack('8H', 0x1234, 0x5678, 0x9ABC, 0xDEF0, + 0x1111, 0x2222, 0x3333, 0x4444) + im = pyvips.Image.new_from_memory(data, 2, 1, 4, 'ushort') + im.pil() + + assert seen[0][0] == 'RGB' + assert seen[1][0] == 'RGBA' + assert seen[0][1] in ('RGB;16L', 'RGB;16B') + assert seen[1][1] in ('RGBA;16L', 'RGBA;16B') + + def test_to_PIL_8bit_modes(self): + try: + import PIL.Image + except ImportError: + pytest.skip('PIL not available') + + try: + import numpy as np + except ImportError: + pytest.skip('numpy not available') + + im = pyvips.Image.new_from_memory(bytes([0, 128, 255, 64]), + 2, 2, 1, 'uchar') + pim = im.pil() + assert pim.mode == 'L' + assert pim.size == (2, 2) + assert pim.getpixel((0, 0)) == 0 + assert pim.getpixel((1, 0)) == 128 + + im = pyvips.Image.new_from_memory(bytes([10, 20, 30, 40]), + 2, 1, 2, 'uchar') + pim = im.pil() + assert pim.mode == 'LA' + assert pim.getpixel((0, 0)) == (10, 20) + assert pim.getpixel((1, 0)) == (30, 40) + + im = pyvips.Image.new_from_memory(bytes([1, 2, 3, 4, 5, 6]), + 2, 1, 3, 'uchar') + pim = im.pil() + assert pim.mode == 'RGB' + assert pim.getpixel((0, 0)) == (1, 2, 3) + assert pim.getpixel((1, 0)) == (4, 5, 6) + + im = pyvips.Image.new_from_memory(bytes([1, 2, 3, 4, 5, 6, 7, 8]), + 2, 1, 4, 'uchar') + pim = im.pil() + assert pim.mode == 'RGBA' + assert pim.getpixel((0, 0)) == (1, 2, 3, 4) + assert pim.getpixel((1, 0)) == (5, 6, 7, 8) + + def test_to_PIL_16bit_la(self): + try: + import PIL.Image + except ImportError: + pytest.skip('PIL not available') + + endian = '<' if sys.byteorder == 'little' else '>' + data = struct.pack( + f'{endian}4H', + 0x1234, + 0x5678, + 0x9ABC, + 0xDEF0 + ) + im = pyvips.Image.new_from_memory(data, 2, 1, 2, 'ushort') + + pim = im.pil() + assert pim.mode == 'RGBA' + assert pim.size == (2, 1) + assert pim.getpixel((0, 0)) == (0x12, 0x12, 0x12, 0x56) + assert pim.getpixel((1, 0)) == (0x9A, 0x9A, 0x9A, 0xDE) + + def test_to_PIL_16bit_rgba(self): + try: + import PIL.Image + except ImportError: + pytest.skip('PIL not available') + + endian = '<' if sys.byteorder == 'little' else '>' + data = struct.pack( + f'{endian}8H', + 0x1234, + 0x5678, + 0x9ABC, + 0xDEF0, + 0x1111, + 0x2222, + 0x3333, + 0x4444 + ) + im = pyvips.Image.new_from_memory(data, 2, 1, 4, 'ushort') + + pim = im.pil() + assert pim.mode == 'RGBA' + assert pim.size == (2, 1) + assert pim.getpixel((0, 0)) == (0x12, 0x56, 0x9A, 0xDE) + assert pim.getpixel((1, 0)) == (0x11, 0x22, 0x33, 0x44) + + def test_to_PIL_16bit_l(self): + try: + import PIL.Image + except ImportError: + pytest.skip('PIL not available') + + try: + import numpy as np + except ImportError: + pytest.skip('numpy not available') + + endian = '<' if sys.byteorder == 'little' else '>' + data = struct.pack(f'{endian}2H', 0x1234, 0x9ABC) + im = pyvips.Image.new_from_memory(data, 2, 1, 1, 'ushort') + + pim = im.pil() + assert pim.size == (2, 1) + assert pim.getpixel((0, 0)) == 0x1234 + assert pim.getpixel((1, 0)) == 0x9ABC + + def test_to_PIL_16bit_5band_unsupported(self): + try: + import PIL.Image + except ImportError: + pytest.skip('PIL not available') + + data = struct.pack('5H', 0x1111, 0x2222, 0x3333, 0x4444, 0x5555) + im = pyvips.Image.new_from_memory(data, 1, 1, 5, 'ushort') + + with pytest.raises(ValueError): + im.pil() + @skip_if_no('uhdrload') def test_gainmap(self): def crop_gainmap(image): From a124c1cc19496bedc556de89aefa3b41dfe946d4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 6 Jul 2026 15:46:56 +0100 Subject: [PATCH 2/5] fix flake8 --- README.rst | 5 +++-- pyvips/vimage.py | 7 ++++--- tests/test_image.py | 29 +++++++++++++++-------------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/README.rst b/README.rst index c89c9fc..6c936c2 100644 --- a/README.rst +++ b/README.rst @@ -236,8 +236,9 @@ Stylecheck: Type checking: -pyvips includes type hints via PEP 561 type stub files (``pyvips/__init__.pyi``). -To enable type checking in your project, install a type checker like mypy: +pyvips includes type hints via PEP 561 type stub files +(``pyvips/__init__.pyi``). To enable type checking in your project, +install a type checker like mypy: .. code-block:: shell diff --git a/pyvips/vimage.py b/pyvips/vimage.py index 58a674b..6684ef1 100644 --- a/pyvips/vimage.py +++ b/pyvips/vimage.py @@ -1285,14 +1285,14 @@ def pil(self): """Convert the image to a PIL Image. This uses :meth:`PIL.Image.fromarray` for most formats and falls back - to raw-mode conversion for formats not natively supported by that + to raw-mode conversion for formats not natively supported by that method. Notes: - Pillow stores RGB/RGBA data as 8-bit, so 16-bit inputs will be converted by keeping the high byte of each channel. - - Pillow expands LA inputs to RGBA by duplicating the L channel into + - Pillow expands LA inputs to RGBA by duplicating the L channel into RGB. PIL is a runtime dependency of this function. @@ -1323,7 +1323,8 @@ def pil(self): mode = 'RGBA' rawmode = 'RGBA;16L' if sys.byteorder == 'little' else 'RGBA;16B' else: - raise ValueError('PIL does not support 16-bit images with more than 4 bands') + raise ValueError('PIL does not support 16-bit images ' + + 'with more than 4 bands') return PILImage.frombytes(mode, (self.width, self.height), diff --git a/tests/test_image.py b/tests/test_image.py index 50f27c2..878c4fb 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -399,12 +399,12 @@ def test_from_PIL(self): def test_to_PIL_16bit(self): try: - import PIL.Image + import PIL.Image # noqa: F401 except ImportError: pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') @@ -433,7 +433,7 @@ def test_to_PIL_16bit_rawmode_rgb_rgba(self, monkeypatch): pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') @@ -445,7 +445,8 @@ def fake_frombytes(mode, size, data, decoder_name, rawmode): monkeypatch.setattr(PILImage, "frombytes", fake_frombytes) - data = struct.pack('6H', 0x1234, 0x5678, 0x9ABC, 0xDEF0, 0x1111, 0x2222) + data = struct.pack('6H', 0x1234, 0x5678, 0x9ABC, 0xDEF0, + 0x1111, 0x2222) im = pyvips.Image.new_from_memory(data, 2, 1, 3, 'ushort') im.pil() @@ -461,12 +462,12 @@ def fake_frombytes(mode, size, data, decoder_name, rawmode): def test_to_PIL_8bit_modes(self): try: - import PIL.Image + import PIL.Image # noqa: F401 except ImportError: pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') @@ -501,12 +502,12 @@ def test_to_PIL_8bit_modes(self): def test_to_PIL_16bit_la(self): try: - import PIL.Image + import PIL.Image # noqa: F401 except ImportError: pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') @@ -528,12 +529,12 @@ def test_to_PIL_16bit_la(self): def test_to_PIL_16bit_rgba(self): try: - import PIL.Image + import PIL.Image # noqa: F401 except ImportError: pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') @@ -559,12 +560,12 @@ def test_to_PIL_16bit_rgba(self): def test_to_PIL_16bit_l(self): try: - import PIL.Image + import PIL.Image # noqa: F401 except ImportError: pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') @@ -579,12 +580,12 @@ def test_to_PIL_16bit_l(self): def test_to_PIL_16bit_5band_unsupported(self): try: - import PIL.Image + import PIL.Image # noqa: F401 except ImportError: pytest.skip('PIL not available') try: - import numpy as np + import numpy as np # noqa: F401 except ImportError: pytest.skip('numpy not available') From 1b15564e7bb28d076f0f519fd109171418fab6ae Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 6 Jul 2026 16:10:45 +0100 Subject: [PATCH 3/5] try to fix a mysterious trailing space error --- examples/watermark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/watermark.py b/examples/watermark.py index 2a00f4c..7009768 100755 --- a/examples/watermark.py +++ b/examples/watermark.py @@ -19,7 +19,7 @@ text = text.rotate(45) # tile to the size of the image page, then tile again to the full image size -text = text.embed(10, 10, text.width + 20, text.width + 20) +text = text.embed(10, 10, text.width + 20, text.width + 20) # noqa: W291 page_height = im.get_page_height() text = text.replicate( int(1 + im.width / text.width), int(1 + page_height / text.height) From 753cc083d57f547e63fe56b0e216e3c2f853e3f4 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 6 Jul 2026 16:26:38 +0100 Subject: [PATCH 4/5] another try --- examples/watermark.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/examples/watermark.py b/examples/watermark.py index 7009768..2af0c83 100755 --- a/examples/watermark.py +++ b/examples/watermark.py @@ -5,13 +5,11 @@ im = pyvips.Image.new_from_file(sys.argv[1], access="sequential") -text = pyvips.Image.text( - f'{sys.argv[3]}', - width=500, - dpi=100, - align="centre", - rgba=True, -) +text = pyvips.Image.text(f'{sys.argv[3]}', + width=500, + dpi=100, + align="centre", + rgba=True) # scale the alpha down to make the text semi-transparent text = (text * [1, 1, 1, 0.3]).cast("uchar") # type: ignore @@ -19,11 +17,10 @@ text = text.rotate(45) # tile to the size of the image page, then tile again to the full image size -text = text.embed(10, 10, text.width + 20, text.width + 20) # noqa: W291 +text = text.embed(10, 10, text.width + 20, text.width + 20) page_height = im.get_page_height() -text = text.replicate( - int(1 + im.width / text.width), int(1 + page_height / text.height) -) +text = text.replicate(int(1 + im.width / text.width), + int(1 + page_height / text.height)) text = text.crop(0, 0, im.width, page_height) text = text.replicate(1, int(1 + im.height / text.height)) text = text.crop(0, 0, im.width, im.height) From 946a6ea1ffb28600ba1bd8cba41db851c05e63cd Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 6 Jul 2026 16:44:30 +0100 Subject: [PATCH 5/5] regen, again --- doc/vimage.rst | 998 ++++++++++++++++++++++---------------------- pyvips/__init__.pyi | 38 +- 2 files changed, 521 insertions(+), 515 deletions(-) diff --git a/doc/vimage.rst b/doc/vimage.rst index 30afb11..072d344 100644 --- a/doc/vimage.rst +++ b/doc/vimage.rst @@ -688,12 +688,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: affine(matrix, interpolate=GObject, oarea=list[int], odx=float, ody=float, idx=float, idy=float, background=list[float], premultiplied=bool, extend=Union[str, Extend]) + .. method:: affine(matrix, interpolate=GObject, oarea=list[int], odx=float, ody=float, idx=float, idy=float, background=list[float], premultiplied=bool, extend=str | Extend) Affine transform of an image. Example: - out = in.affine(matrix, interpolate=GObject, oarea=list[int], odx=float, ody=float, idx=float, idy=float, background=list[float], premultiplied=bool, extend=Union[str, Extend]) + out = in.affine(matrix, interpolate=GObject, oarea=list[int], odx=float, ody=float, idx=float, idy=float, background=list[float], premultiplied=bool, extend=str | Extend) :param matrix: Transformation matrix :type matrix: list[float] @@ -714,25 +714,25 @@ Autogenerated methods :param premultiplied: Images have premultiplied alpha :type premultiplied: bool :param extend: How to generate the extra pixels - :type extend: Union[str, Extend] + :type extend: str | Extend :rtype: Image :raises Error: - .. staticmethod:: analyzeload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: analyzeload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load an Analyze6 image. Example: - out = pyvips.Image.analyzeload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.analyzeload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -740,12 +740,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: arrayjoin(in, across=int, shim=int, background=list[float], halign=Union[str, Align], valign=Union[str, Align], hspacing=int, vspacing=int) + .. staticmethod:: arrayjoin(in, across=int, shim=int, background=list[float], halign=str | Align, valign=str | Align, hspacing=int, vspacing=int) Join an array of images. Example: - out = pyvips.Image.arrayjoin(in, across=int, shim=int, background=list[float], halign=Union[str, Align], valign=Union[str, Align], hspacing=int, vspacing=int) + out = pyvips.Image.arrayjoin(in, across=int, shim=int, background=list[float], halign=str | Align, valign=str | Align, hspacing=int, vspacing=int) :param in: Array of input images :type in: list[Image] @@ -756,9 +756,9 @@ Autogenerated methods :param background: Colour for new pixels :type background: list[float] :param halign: Align on the left, centre or right - :type halign: Union[str, Align] + :type halign: str | Align :param valign: Align on the top, centre or bottom - :type valign: Union[str, Align] + :type valign: str | Align :param hspacing: Horizontal spacing between images :type hspacing: int :param vspacing: Vertical spacing between images @@ -798,7 +798,7 @@ Autogenerated methods out = in.bandbool(boolean) :param boolean: Boolean to perform - :type boolean: Union[str, OperationBoolean] + :type boolean: str | OperationBoolean :rtype: Image :raises Error: @@ -874,7 +874,7 @@ Autogenerated methods :param right: Right-hand image argument :type right: Image :param boolean: Boolean to perform - :type boolean: Union[str, OperationBoolean] + :type boolean: str | OperationBoolean :rtype: Image :raises Error: @@ -886,7 +886,7 @@ Autogenerated methods out = in.boolean_const(boolean, c) :param boolean: Boolean to perform - :type boolean: Union[str, OperationBoolean] + :type boolean: str | OperationBoolean :param c: Array of constants :type c: list[float] :rtype: Image @@ -912,17 +912,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: canny(sigma=float, precision=Union[str, Precision]) + .. method:: canny(sigma=float, precision=str | Precision) Canny edge detector. Example: - out = in.canny(sigma=float, precision=Union[str, Precision]) + out = in.canny(sigma=float, precision=str | Precision) :param sigma: Sigma of Gaussian :type sigma: float :param precision: Convolve with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :rtype: Image :raises Error: @@ -946,7 +946,7 @@ Autogenerated methods out = in.cast(format, shift=bool) :param format: Format to cast to - :type format: Union[str, BandFormat] + :type format: str | BandFormat :param shift: Shift integer values up and down :type shift: bool :rtype: Image @@ -966,37 +966,37 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: colourspace(space, source_space=Union[str, Interpretation]) + .. method:: colourspace(space, source_space=str | Interpretation) Convert to a new colorspace. Example: - out = in.colourspace(space, source_space=Union[str, Interpretation]) + out = in.colourspace(space, source_space=str | Interpretation) :param space: Destination color space - :type space: Union[str, Interpretation] + :type space: str | Interpretation :param source_space: Source color space - :type source_space: Union[str, Interpretation] + :type source_space: str | Interpretation :rtype: Image :raises Error: - .. method:: compass(mask, times=int, angle=Union[str, Angle45], combine=Union[str, Combine], precision=Union[str, Precision], layers=int, cluster=int) + .. method:: compass(mask, times=int, angle=str | Angle45, combine=str | Combine, precision=str | Precision, layers=int, cluster=int) Convolve with rotating mask. Example: - out = in.compass(mask, times=int, angle=Union[str, Angle45], combine=Union[str, Combine], precision=Union[str, Precision], layers=int, cluster=int) + out = in.compass(mask, times=int, angle=str | Angle45, combine=str | Combine, precision=str | Precision, layers=int, cluster=int) :param mask: Input matrix image :type mask: Image :param times: Rotate and convolve this many times :type times: int :param angle: Rotate mask by this much between convolutions - :type angle: Union[str, Angle45] + :type angle: str | Angle45 :param combine: Combine convolution results like this - :type combine: Union[str, Combine] + :type combine: str | Combine :param precision: Convolve with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :param layers: Use this many layers in approximation :type layers: int :param cluster: Cluster lines closer than this in approximation @@ -1012,7 +1012,7 @@ Autogenerated methods out = in.complex(cmplx) :param cmplx: Complex to perform - :type cmplx: Union[str, OperationComplex] + :type cmplx: str | OperationComplex :rtype: Image :raises Error: @@ -1026,7 +1026,7 @@ Autogenerated methods :param right: Right-hand image argument :type right: Image :param cmplx: Binary complex operation to perform - :type cmplx: Union[str, OperationComplex2] + :type cmplx: str | OperationComplex2 :rtype: Image :raises Error: @@ -1050,16 +1050,16 @@ Autogenerated methods out = in.complexget(get) :param get: Complex to perform - :type get: Union[str, OperationComplexget] + :type get: str | OperationComplexget :rtype: Image :raises Error: - .. staticmethod:: composite(in, mode, x=list[int], y=list[int], compositing_space=Union[str, Interpretation], premultiplied=bool) + .. staticmethod:: composite(in, mode, x=list[int], y=list[int], compositing_space=str | Interpretation, premultiplied=bool) Blend an array of images with an array of blend modes. Example: - out = pyvips.Image.composite(in, mode, x=list[int], y=list[int], compositing_space=Union[str, Interpretation], premultiplied=bool) + out = pyvips.Image.composite(in, mode, x=list[int], y=list[int], compositing_space=str | Interpretation, premultiplied=bool) :param in: Array of input images :type in: list[Image] @@ -1070,45 +1070,45 @@ Autogenerated methods :param y: Array of y coordinates to join at :type y: list[int] :param compositing_space: Composite images in this colour space - :type compositing_space: Union[str, Interpretation] + :type compositing_space: str | Interpretation :param premultiplied: Images have premultiplied alpha :type premultiplied: bool :rtype: Image :raises Error: - .. method:: composite2(overlay, mode, x=int, y=int, compositing_space=Union[str, Interpretation], premultiplied=bool) + .. method:: composite2(overlay, mode, x=int, y=int, compositing_space=str | Interpretation, premultiplied=bool) Blend a pair of images with a blend mode. Example: - out = base.composite2(overlay, mode, x=int, y=int, compositing_space=Union[str, Interpretation], premultiplied=bool) + out = base.composite2(overlay, mode, x=int, y=int, compositing_space=str | Interpretation, premultiplied=bool) :param overlay: Overlay image :type overlay: Image :param mode: VipsBlendMode to join with - :type mode: Union[str, BlendMode] + :type mode: str | BlendMode :param x: x position of overlay :type x: int :param y: y position of overlay :type y: int :param compositing_space: Composite images in this colour space - :type compositing_space: Union[str, Interpretation] + :type compositing_space: str | Interpretation :param premultiplied: Images have premultiplied alpha :type premultiplied: bool :rtype: Image :raises Error: - .. method:: conv(mask, precision=Union[str, Precision], layers=int, cluster=int) + .. method:: conv(mask, precision=str | Precision, layers=int, cluster=int) Convolution operation. Example: - out = in.conv(mask, precision=Union[str, Precision], layers=int, cluster=int) + out = in.conv(mask, precision=str | Precision, layers=int, cluster=int) :param mask: Input matrix image :type mask: Image :param precision: Convolve with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :param layers: Use this many layers in approximation :type layers: int :param cluster: Cluster lines closer than this in approximation @@ -1170,17 +1170,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: convsep(mask, precision=Union[str, Precision], layers=int, cluster=int) + .. method:: convsep(mask, precision=str | Precision, layers=int, cluster=int) Separable convolution operation. Example: - out = in.convsep(mask, precision=Union[str, Precision], layers=int, cluster=int) + out = in.convsep(mask, precision=str | Precision, layers=int, cluster=int) :param mask: Input matrix image :type mask: Image :param precision: Convolve with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :param layers: Use this many layers in approximation :type layers: int :param cluster: Cluster lines closer than this in approximation @@ -1188,12 +1188,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: copy(width=int, height=int, bands=int, format=Union[str, BandFormat], coding=Union[str, Coding], interpretation=Union[str, Interpretation], xres=float, yres=float, xoffset=int, yoffset=int) + .. method:: copy(width=int, height=int, bands=int, format=str | BandFormat, coding=str | Coding, interpretation=str | Interpretation, xres=float, yres=float, xoffset=int, yoffset=int) Copy an image. Example: - out = in.copy(width=int, height=int, bands=int, format=Union[str, BandFormat], coding=Union[str, Coding], interpretation=Union[str, Interpretation], xres=float, yres=float, xoffset=int, yoffset=int) + out = in.copy(width=int, height=int, bands=int, format=str | BandFormat, coding=str | Coding, interpretation=str | Interpretation, xres=float, yres=float, xoffset=int, yoffset=int) :param width: Image width in pixels :type width: int @@ -1202,11 +1202,11 @@ Autogenerated methods :param bands: Number of bands in image :type bands: int :param format: Pixel format in image - :type format: Union[str, BandFormat] + :type format: str | BandFormat :param coding: Pixel coding - :type coding: Union[str, Coding] + :type coding: str | Coding :param interpretation: Pixel interpretation - :type interpretation: Union[str, Interpretation] + :type interpretation: str | Interpretation :param xres: Horizontal resolution in pixels/mm :type xres: float :param yres: Vertical resolution in pixels/mm @@ -1226,7 +1226,7 @@ Autogenerated methods nolines = in.countlines(direction) :param direction: Countlines left-right or up-down - :type direction: Union[str, Direction] + :type direction: str | Direction :rtype: float :raises Error: @@ -1248,12 +1248,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: csvload(filename, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: csvload(filename, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load csv. Example: - out = pyvips.Image.csvload(filename, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.csvload(filename, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -1268,9 +1268,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -1278,12 +1278,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: csvload_source(source, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: csvload_source(source, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load csv. Example: - out = pyvips.Image.csvload_source(source, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.csvload_source(source, skip=int, lines=int, whitespace=str, separator=str, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -1298,9 +1298,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -1386,12 +1386,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: dcrawload(filename, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: dcrawload(filename, bitdepth=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load RAW camera files. Example: - out = pyvips.Image.dcrawload(filename, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.dcrawload(filename, bitdepth=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -1400,9 +1400,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -1410,12 +1410,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: dcrawload_buffer(buffer, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: dcrawload_buffer(buffer, bitdepth=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load RAW camera files. Example: - out = pyvips.Image.dcrawload_buffer(buffer, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.dcrawload_buffer(buffer, bitdepth=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -1424,20 +1424,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: dcrawload_source(source, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: dcrawload_source(source, bitdepth=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load RAW camera files. Example: - out = pyvips.Image.dcrawload_source(source, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.dcrawload_source(source, bitdepth=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -1446,9 +1446,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -1524,12 +1524,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: draw_image(sub, x, y, mode=Union[str, CombineMode]) + .. method:: draw_image(sub, x, y, mode=str | CombineMode) Paint an image into another image. Example: - image = image.draw_image(sub, x, y, mode=Union[str, CombineMode]) + image = image.draw_image(sub, x, y, mode=str | CombineMode) :param sub: Sub-image to insert into main image :type sub: Image @@ -1538,7 +1538,7 @@ Autogenerated methods :param y: Draw image here :type y: int :param mode: Combining mode - :type mode: Union[str, CombineMode] + :type mode: str | CombineMode :rtype: Image :raises Error: @@ -1620,19 +1620,19 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: dzsave(filename, imagename=str, layout=Union[str, ForeignDzLayout], suffix=str, overlap=int, tile_size=int, centre=bool, depth=Union[str, ForeignDzDepth], angle=Union[str, Angle], container=Union[str, ForeignDzContainer], compression=int, region_shrink=Union[str, RegionShrink], skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: dzsave(filename, imagename=str, layout=str | ForeignDzLayout, suffix=str, overlap=int, tile_size=int, centre=bool, depth=str | ForeignDzDepth, angle=str | Angle, container=str | ForeignDzContainer, compression=int, region_shrink=str | RegionShrink, skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to deepzoom file. Example: - in.dzsave(filename, imagename=str, layout=Union[str, ForeignDzLayout], suffix=str, overlap=int, tile_size=int, centre=bool, depth=Union[str, ForeignDzDepth], angle=Union[str, Angle], container=Union[str, ForeignDzContainer], compression=int, region_shrink=Union[str, RegionShrink], skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.dzsave(filename, imagename=str, layout=str | ForeignDzLayout, suffix=str, overlap=int, tile_size=int, centre=bool, depth=str | ForeignDzDepth, angle=str | Angle, container=str | ForeignDzContainer, compression=int, region_shrink=str | RegionShrink, skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path :param imagename: Image name :type imagename: str :param layout: Directory layout - :type layout: Union[str, ForeignDzLayout] + :type layout: str | ForeignDzLayout :param suffix: Filename suffix for tiles :type suffix: str :param overlap: Tile overlap in pixels @@ -1642,15 +1642,15 @@ Autogenerated methods :param centre: Center image in tile :type centre: bool :param depth: Pyramid depth - :type depth: Union[str, ForeignDzDepth] + :type depth: str | ForeignDzDepth :param angle: Rotate image during save - :type angle: Union[str, Angle] + :type angle: str | Angle :param container: Pyramid container type - :type container: Union[str, ForeignDzContainer] + :type container: str | ForeignDzContainer :param compression: ZIP deflate compression level :type compression: int :param region_shrink: Method to shrink regions - :type region_shrink: Union[str, RegionShrink] + :type region_shrink: str | RegionShrink :param skip_blanks: Skip tiles which are nearly equal to the background :type skip_blanks: int :param id: Resource ID @@ -1668,17 +1668,17 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: dzsave_buffer(imagename=str, layout=Union[str, ForeignDzLayout], suffix=str, overlap=int, tile_size=int, centre=bool, depth=Union[str, ForeignDzDepth], angle=Union[str, Angle], container=Union[str, ForeignDzContainer], compression=int, region_shrink=Union[str, RegionShrink], skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: dzsave_buffer(imagename=str, layout=str | ForeignDzLayout, suffix=str, overlap=int, tile_size=int, centre=bool, depth=str | ForeignDzDepth, angle=str | Angle, container=str | ForeignDzContainer, compression=int, region_shrink=str | RegionShrink, skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to dz buffer. Example: - buffer = in.dzsave_buffer(imagename=str, layout=Union[str, ForeignDzLayout], suffix=str, overlap=int, tile_size=int, centre=bool, depth=Union[str, ForeignDzDepth], angle=Union[str, Angle], container=Union[str, ForeignDzContainer], compression=int, region_shrink=Union[str, RegionShrink], skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) + buffer = in.dzsave_buffer(imagename=str, layout=str | ForeignDzLayout, suffix=str, overlap=int, tile_size=int, centre=bool, depth=str | ForeignDzDepth, angle=str | Angle, container=str | ForeignDzContainer, compression=int, region_shrink=str | RegionShrink, skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param imagename: Image name :type imagename: str :param layout: Directory layout - :type layout: Union[str, ForeignDzLayout] + :type layout: str | ForeignDzLayout :param suffix: Filename suffix for tiles :type suffix: str :param overlap: Tile overlap in pixels @@ -1688,15 +1688,15 @@ Autogenerated methods :param centre: Center image in tile :type centre: bool :param depth: Pyramid depth - :type depth: Union[str, ForeignDzDepth] + :type depth: str | ForeignDzDepth :param angle: Rotate image during save - :type angle: Union[str, Angle] + :type angle: str | Angle :param container: Pyramid container type - :type container: Union[str, ForeignDzContainer] + :type container: str | ForeignDzContainer :param compression: ZIP deflate compression level :type compression: int :param region_shrink: Method to shrink regions - :type region_shrink: Union[str, RegionShrink] + :type region_shrink: str | RegionShrink :param skip_blanks: Skip tiles which are nearly equal to the background :type skip_blanks: int :param id: Resource ID @@ -1714,19 +1714,19 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: dzsave_target(target, imagename=str, layout=Union[str, ForeignDzLayout], suffix=str, overlap=int, tile_size=int, centre=bool, depth=Union[str, ForeignDzDepth], angle=Union[str, Angle], container=Union[str, ForeignDzContainer], compression=int, region_shrink=Union[str, RegionShrink], skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: dzsave_target(target, imagename=str, layout=str | ForeignDzLayout, suffix=str, overlap=int, tile_size=int, centre=bool, depth=str | ForeignDzDepth, angle=str | Angle, container=str | ForeignDzContainer, compression=int, region_shrink=str | RegionShrink, skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to deepzoom target. Example: - in.dzsave_target(target, imagename=str, layout=Union[str, ForeignDzLayout], suffix=str, overlap=int, tile_size=int, centre=bool, depth=Union[str, ForeignDzDepth], angle=Union[str, Angle], container=Union[str, ForeignDzContainer], compression=int, region_shrink=Union[str, RegionShrink], skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.dzsave_target(target, imagename=str, layout=str | ForeignDzLayout, suffix=str, overlap=int, tile_size=int, centre=bool, depth=str | ForeignDzDepth, angle=str | Angle, container=str | ForeignDzContainer, compression=int, region_shrink=str | RegionShrink, skip_blanks=int, id=str, Q=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target :param imagename: Image name :type imagename: str :param layout: Directory layout - :type layout: Union[str, ForeignDzLayout] + :type layout: str | ForeignDzLayout :param suffix: Filename suffix for tiles :type suffix: str :param overlap: Tile overlap in pixels @@ -1736,15 +1736,15 @@ Autogenerated methods :param centre: Center image in tile :type centre: bool :param depth: Pyramid depth - :type depth: Union[str, ForeignDzDepth] + :type depth: str | ForeignDzDepth :param angle: Rotate image during save - :type angle: Union[str, Angle] + :type angle: str | Angle :param container: Pyramid container type - :type container: Union[str, ForeignDzContainer] + :type container: str | ForeignDzContainer :param compression: ZIP deflate compression level :type compression: int :param region_shrink: Method to shrink regions - :type region_shrink: Union[str, RegionShrink] + :type region_shrink: str | RegionShrink :param skip_blanks: Skip tiles which are nearly equal to the background :type skip_blanks: int :param id: Resource ID @@ -1762,12 +1762,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: embed(x, y, width, height, extend=Union[str, Extend], background=list[float]) + .. method:: embed(x, y, width, height, extend=str | Extend, background=list[float]) Embed an image in a larger image. Example: - out = in.embed(x, y, width, height, extend=Union[str, Extend], background=list[float]) + out = in.embed(x, y, width, height, extend=str | Extend, background=list[float]) :param x: Left edge of input in output :type x: int @@ -1778,7 +1778,7 @@ Autogenerated methods :param height: Image height in pixels :type height: int :param extend: How to generate the extra pixels - :type extend: Union[str, Extend] + :type extend: str | Extend :param background: Color for background pixels :type background: list[float] :rtype: Image @@ -1884,21 +1884,21 @@ Autogenerated methods :rtype: list[int, int, int, int] :raises Error: - .. staticmethod:: fitsload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: fitsload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load a FITS image. Example: - out = pyvips.Image.fitsload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.fitsload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -1906,21 +1906,21 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: fitsload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: fitsload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load FITS from a source. Example: - out = pyvips.Image.fitsload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.fitsload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -1968,7 +1968,7 @@ Autogenerated methods out = in.flip(direction) :param direction: Direction to flip image - :type direction: Union[str, Direction] + :type direction: str | Direction :rtype: Image :raises Error: @@ -2032,28 +2032,28 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: gaussblur(sigma, min_ampl=float, precision=Union[str, Precision]) + .. method:: gaussblur(sigma, min_ampl=float, precision=str | Precision) Gaussian blur. Example: - out = in.gaussblur(sigma, min_ampl=float, precision=Union[str, Precision]) + out = in.gaussblur(sigma, min_ampl=float, precision=str | Precision) :param sigma: Sigma of Gaussian :type sigma: float :param min_ampl: Minimum amplitude of Gaussian :type min_ampl: float :param precision: Convolve with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :rtype: Image :raises Error: - .. staticmethod:: gaussmat(sigma, min_ampl, separable=bool, precision=Union[str, Precision]) + .. staticmethod:: gaussmat(sigma, min_ampl, separable=bool, precision=str | Precision) Make a gaussian image. Example: - out = pyvips.Image.gaussmat(sigma, min_ampl, separable=bool, precision=Union[str, Precision]) + out = pyvips.Image.gaussmat(sigma, min_ampl, separable=bool, precision=str | Precision) :param sigma: Sigma of Gaussian :type sigma: float @@ -2062,7 +2062,7 @@ Autogenerated methods :param separable: Generate separable Gaussian :type separable: bool :param precision: Generate with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :rtype: Image :raises Error: @@ -2102,12 +2102,12 @@ Autogenerated methods :rtype: list[float] :raises Error: - .. staticmethod:: gifload(filename, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: gifload(filename, n=int, page=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load GIF with libnsgif. Example: - out = pyvips.Image.gifload(filename, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.gifload(filename, n=int, page=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -2118,9 +2118,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -2128,12 +2128,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: gifload_buffer(buffer, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: gifload_buffer(buffer, n=int, page=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load GIF with libnsgif. Example: - out = pyvips.Image.gifload_buffer(buffer, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.gifload_buffer(buffer, n=int, page=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -2144,20 +2144,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: gifload_source(source, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: gifload_source(source, n=int, page=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load gif from source. Example: - out = pyvips.Image.gifload_source(source, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.gifload_source(source, n=int, page=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -2168,9 +2168,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -2296,21 +2296,21 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: gravity(direction, width, height, extend=Union[str, Extend], background=list[float]) + .. method:: gravity(direction, width, height, extend=str | Extend, background=list[float]) Place an image within a larger image with a certain gravity. Example: - out = in.gravity(direction, width, height, extend=Union[str, Extend], background=list[float]) + out = in.gravity(direction, width, height, extend=str | Extend, background=list[float]) :param direction: Direction to place image within width/height - :type direction: Union[str, CompassDirection] + :type direction: str | CompassDirection :param width: Image width in pixels :type width: int :param height: Image height in pixels :type height: int :param extend: How to generate the extra pixels - :type extend: Union[str, Extend] + :type extend: str | Extend :param background: Color for background pixels :type background: list[float] :rtype: Image @@ -2348,12 +2348,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: heifload(filename, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: heifload(filename, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load a HEIF image. Example: - out = pyvips.Image.heifload(filename, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.heifload(filename, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -2368,9 +2368,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -2378,12 +2378,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: heifload_buffer(buffer, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: heifload_buffer(buffer, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load a HEIF image. Example: - out = pyvips.Image.heifload_buffer(buffer, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.heifload_buffer(buffer, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -2398,20 +2398,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: heifload_source(source, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: heifload_source(source, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load a HEIF image. Example: - out = pyvips.Image.heifload_source(source, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.heifload_source(source, page=int, n=int, thumbnail=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -2426,20 +2426,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: heifsave(filename, Q=int, bitdepth=int, lossless=bool, compression=Union[str, ForeignHeifCompression], effort=int, subsample_mode=Union[str, ForeignSubsample], encoder=Union[str, ForeignHeifEncoder], tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: heifsave(filename, Q=int, bitdepth=int, lossless=bool, compression=str | ForeignHeifCompression, effort=int, subsample_mode=str | ForeignSubsample, encoder=str | ForeignHeifEncoder, tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in HEIF format. Example: - in.heifsave(filename, Q=int, bitdepth=int, lossless=bool, compression=Union[str, ForeignHeifCompression], effort=int, subsample_mode=Union[str, ForeignSubsample], encoder=Union[str, ForeignHeifEncoder], tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) + in.heifsave(filename, Q=int, bitdepth=int, lossless=bool, compression=str | ForeignHeifCompression, effort=int, subsample_mode=str | ForeignSubsample, encoder=str | ForeignHeifEncoder, tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path @@ -2450,13 +2450,13 @@ Autogenerated methods :param lossless: Enable lossless compression :type lossless: bool :param compression: Compression format - :type compression: Union[str, ForeignHeifCompression] + :type compression: str | ForeignHeifCompression :param effort: CPU effort :type effort: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param encoder: Select encoder to use - :type encoder: Union[str, ForeignHeifEncoder] + :type encoder: str | ForeignHeifEncoder :param tune: Tuning parameters :type tune: str :param keep: Which metadata to retain @@ -2470,12 +2470,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: heifsave_buffer(Q=int, bitdepth=int, lossless=bool, compression=Union[str, ForeignHeifCompression], effort=int, subsample_mode=Union[str, ForeignSubsample], encoder=Union[str, ForeignHeifEncoder], tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: heifsave_buffer(Q=int, bitdepth=int, lossless=bool, compression=str | ForeignHeifCompression, effort=int, subsample_mode=str | ForeignSubsample, encoder=str | ForeignHeifEncoder, tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in HEIF format. Example: - buffer = in.heifsave_buffer(Q=int, bitdepth=int, lossless=bool, compression=Union[str, ForeignHeifCompression], effort=int, subsample_mode=Union[str, ForeignSubsample], encoder=Union[str, ForeignHeifEncoder], tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) + buffer = in.heifsave_buffer(Q=int, bitdepth=int, lossless=bool, compression=str | ForeignHeifCompression, effort=int, subsample_mode=str | ForeignSubsample, encoder=str | ForeignHeifEncoder, tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) :param Q: Q factor :type Q: int @@ -2484,13 +2484,13 @@ Autogenerated methods :param lossless: Enable lossless compression :type lossless: bool :param compression: Compression format - :type compression: Union[str, ForeignHeifCompression] + :type compression: str | ForeignHeifCompression :param effort: CPU effort :type effort: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param encoder: Select encoder to use - :type encoder: Union[str, ForeignHeifEncoder] + :type encoder: str | ForeignHeifEncoder :param tune: Tuning parameters :type tune: str :param keep: Which metadata to retain @@ -2504,12 +2504,12 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: heifsave_target(target, Q=int, bitdepth=int, lossless=bool, compression=Union[str, ForeignHeifCompression], effort=int, subsample_mode=Union[str, ForeignSubsample], encoder=Union[str, ForeignHeifEncoder], tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: heifsave_target(target, Q=int, bitdepth=int, lossless=bool, compression=str | ForeignHeifCompression, effort=int, subsample_mode=str | ForeignSubsample, encoder=str | ForeignHeifEncoder, tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in HEIF format. Example: - in.heifsave_target(target, Q=int, bitdepth=int, lossless=bool, compression=Union[str, ForeignHeifCompression], effort=int, subsample_mode=Union[str, ForeignSubsample], encoder=Union[str, ForeignHeifEncoder], tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) + in.heifsave_target(target, Q=int, bitdepth=int, lossless=bool, compression=str | ForeignHeifCompression, effort=int, subsample_mode=str | ForeignSubsample, encoder=str | ForeignHeifEncoder, tune=str, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -2520,13 +2520,13 @@ Autogenerated methods :param lossless: Enable lossless compression :type lossless: bool :param compression: Compression format - :type compression: Union[str, ForeignHeifCompression] + :type compression: str | ForeignHeifCompression :param effort: CPU effort :type effort: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param encoder: Select encoder to use - :type encoder: Union[str, ForeignHeifEncoder] + :type encoder: str | ForeignHeifEncoder :param tune: Tuning parameters :type tune: str :param keep: Which metadata to retain @@ -2584,17 +2584,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: hist_find_indexed(index, combine=Union[str, Combine]) + .. method:: hist_find_indexed(index, combine=str | Combine) Find indexed image histogram. Example: - out = in.hist_find_indexed(index, combine=Union[str, Combine]) + out = in.hist_find_indexed(index, combine=str | Combine) :param index: Index image :type index: Image :param combine: Combine bins like this - :type combine: Union[str, Combine] + :type combine: str | Combine :rtype: Image :raises Error: @@ -2698,17 +2698,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: icc_export(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, output_profile=str | Path, depth=int) + .. method:: icc_export(pcs=str | PCS, intent=str | Intent, black_point_compensation=bool, output_profile=str | Path, depth=int) Output to device with ICC profile. Example: - out = in.icc_export(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, output_profile=str | Path, depth=int) + out = in.icc_export(pcs=str | PCS, intent=str | Intent, black_point_compensation=bool, output_profile=str | Path, depth=int) :param pcs: Set Profile Connection Space - :type pcs: Union[str, PCS] + :type pcs: str | PCS :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param black_point_compensation: Enable black point compensation :type black_point_compensation: bool :param output_profile: Filename to load output profile from @@ -2718,17 +2718,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: icc_import(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, embedded=bool, input_profile=str | Path) + .. method:: icc_import(pcs=str | PCS, intent=str | Intent, black_point_compensation=bool, embedded=bool, input_profile=str | Path) Import from device with ICC profile. Example: - out = in.icc_import(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, embedded=bool, input_profile=str | Path) + out = in.icc_import(pcs=str | PCS, intent=str | Intent, black_point_compensation=bool, embedded=bool, input_profile=str | Path) :param pcs: Set Profile Connection Space - :type pcs: Union[str, PCS] + :type pcs: str | PCS :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param black_point_compensation: Enable black point compensation :type black_point_compensation: bool :param embedded: Use embedded input profile, if available @@ -2738,19 +2738,19 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: icc_transform(output_profile, pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, embedded=bool, input_profile=str | Path, depth=int) + .. method:: icc_transform(output_profile, pcs=str | PCS, intent=str | Intent, black_point_compensation=bool, embedded=bool, input_profile=str | Path, depth=int) Transform between devices with ICC profiles. Example: - out = in.icc_transform(output_profile, pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, embedded=bool, input_profile=str | Path, depth=int) + out = in.icc_transform(output_profile, pcs=str | PCS, intent=str | Intent, black_point_compensation=bool, embedded=bool, input_profile=str | Path, depth=int) :param output_profile: Filename to load output profile from :type output_profile: str | Path :param pcs: Set Profile Connection Space - :type pcs: Union[str, PCS] + :type pcs: str | PCS :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param black_point_compensation: Enable black point compensation :type black_point_compensation: bool :param embedded: Use embedded input profile, if available @@ -2832,17 +2832,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: join(in2, direction, expand=bool, shim=int, background=list[float], align=Union[str, Align]) + .. method:: join(in2, direction, expand=bool, shim=int, background=list[float], align=str | Align) Join a pair of images. Example: - out = in1.join(in2, direction, expand=bool, shim=int, background=list[float], align=Union[str, Align]) + out = in1.join(in2, direction, expand=bool, shim=int, background=list[float], align=str | Align) :param in2: Second input image :type in2: Image :param direction: Join left-right or up-down - :type direction: Union[str, Direction] + :type direction: str | Direction :param expand: Expand output to hold all of both inputs :type expand: bool :param shim: Pixels between images @@ -2850,16 +2850,16 @@ Autogenerated methods :param background: Colour for new pixels :type background: list[float] :param align: Align on the low, centre or high coordinate edge - :type align: Union[str, Align] + :type align: str | Align :rtype: Image :raises Error: - .. staticmethod:: jp2kload(filename, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: jp2kload(filename, page=int, oneshot=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load JPEG2000 image. Example: - out = pyvips.Image.jp2kload(filename, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.jp2kload(filename, page=int, oneshot=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -2870,9 +2870,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -2880,12 +2880,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: jp2kload_buffer(buffer, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: jp2kload_buffer(buffer, page=int, oneshot=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load JPEG2000 image. Example: - out = pyvips.Image.jp2kload_buffer(buffer, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.jp2kload_buffer(buffer, page=int, oneshot=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -2896,20 +2896,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: jp2kload_source(source, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: jp2kload_source(source, page=int, oneshot=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load JPEG2000 image. Example: - out = pyvips.Image.jp2kload_source(source, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.jp2kload_source(source, page=int, oneshot=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -2920,20 +2920,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: jp2ksave(filename, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=Union[str, ForeignSubsample], keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jp2ksave(filename, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=str | ForeignSubsample, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in JPEG2000 format. Example: - in.jp2ksave(filename, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=Union[str, ForeignSubsample], keep=int, background=list[float], page_height=int, profile=str | Path) + in.jp2ksave(filename, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=str | ForeignSubsample, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path @@ -2946,7 +2946,7 @@ Autogenerated methods :param Q: Q factor :type Q: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -2958,12 +2958,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: jp2ksave_buffer(tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=Union[str, ForeignSubsample], keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jp2ksave_buffer(tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=str | ForeignSubsample, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in JPEG2000 format. Example: - buffer = in.jp2ksave_buffer(tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=Union[str, ForeignSubsample], keep=int, background=list[float], page_height=int, profile=str | Path) + buffer = in.jp2ksave_buffer(tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=str | ForeignSubsample, keep=int, background=list[float], page_height=int, profile=str | Path) :param tile_width: Tile width in pixels :type tile_width: int @@ -2974,7 +2974,7 @@ Autogenerated methods :param Q: Q factor :type Q: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -2986,12 +2986,12 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: jp2ksave_target(target, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=Union[str, ForeignSubsample], keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jp2ksave_target(target, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=str | ForeignSubsample, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in JPEG2000 format. Example: - in.jp2ksave_target(target, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=Union[str, ForeignSubsample], keep=int, background=list[float], page_height=int, profile=str | Path) + in.jp2ksave_target(target, tile_width=int, tile_height=int, lossless=bool, Q=int, subsample_mode=str | ForeignSubsample, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -3004,7 +3004,7 @@ Autogenerated methods :param Q: Q factor :type Q: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -3016,12 +3016,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. staticmethod:: jpegload(filename, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: jpegload(filename, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load jpeg from file. Example: - out = pyvips.Image.jpegload(filename, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.jpegload(filename, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -3034,9 +3034,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -3044,12 +3044,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: jpegload_buffer(buffer, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: jpegload_buffer(buffer, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load jpeg from buffer. Example: - out = pyvips.Image.jpegload_buffer(buffer, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.jpegload_buffer(buffer, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -3062,20 +3062,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: jpegload_source(source, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: jpegload_source(source, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load image from jpeg source. Example: - out = pyvips.Image.jpegload_source(source, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.jpegload_source(source, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -3088,20 +3088,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: jpegsave(filename, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jpegsave(filename, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save as jpeg. Example: - in.jpegsave(filename, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.jpegsave(filename, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path @@ -3120,7 +3120,7 @@ Autogenerated methods :param quant_table: Use predefined quantization table with given index :type quant_table: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param restart_interval: Add restart markers every specified number of mcu :type restart_interval: int :param keep: Which metadata to retain @@ -3134,12 +3134,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: jpegsave_buffer(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jpegsave_buffer(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save as jpeg. Example: - buffer = in.jpegsave_buffer(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + buffer = in.jpegsave_buffer(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param Q: Q factor :type Q: int @@ -3156,7 +3156,7 @@ Autogenerated methods :param quant_table: Use predefined quantization table with given index :type quant_table: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param restart_interval: Add restart markers every specified number of mcu :type restart_interval: int :param keep: Which metadata to retain @@ -3170,12 +3170,12 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: jpegsave_mime(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jpegsave_mime(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to jpeg mime. Example: - in.jpegsave_mime(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.jpegsave_mime(Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param Q: Q factor :type Q: int @@ -3192,7 +3192,7 @@ Autogenerated methods :param quant_table: Use predefined quantization table with given index :type quant_table: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param restart_interval: Add restart markers every specified number of mcu :type restart_interval: int :param keep: Which metadata to retain @@ -3206,12 +3206,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: jpegsave_target(target, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: jpegsave_target(target, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save as jpeg. Example: - in.jpegsave_target(target, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=Union[str, ForeignSubsample], restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.jpegsave_target(target, Q=int, optimize_coding=bool, interlace=bool, trellis_quant=bool, overshoot_deringing=bool, optimize_scans=bool, quant_table=int, subsample_mode=str | ForeignSubsample, restart_interval=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -3230,7 +3230,7 @@ Autogenerated methods :param quant_table: Use predefined quantization table with given index :type quant_table: int :param subsample_mode: Select chroma subsample operation mode - :type subsample_mode: Union[str, ForeignSubsample] + :type subsample_mode: str | ForeignSubsample :param restart_interval: Add restart markers every specified number of mcu :type restart_interval: int :param keep: Which metadata to retain @@ -3244,12 +3244,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. staticmethod:: jxlload(filename, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: jxlload(filename, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load JPEG-XL image. Example: - out = pyvips.Image.jxlload(filename, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.jxlload(filename, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -3260,9 +3260,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -3270,12 +3270,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: jxlload_buffer(buffer, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: jxlload_buffer(buffer, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load JPEG-XL image. Example: - out = pyvips.Image.jxlload_buffer(buffer, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.jxlload_buffer(buffer, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -3286,20 +3286,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: jxlload_source(source, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: jxlload_source(source, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load JPEG-XL image. Example: - out = pyvips.Image.jxlload_source(source, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.jxlload_source(source, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -3310,9 +3310,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -3440,17 +3440,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: linecache(tile_height=int, access=Union[str, Access], threaded=bool, persistent=bool) + .. method:: linecache(tile_height=int, access=str | Access, threaded=bool, persistent=bool) Cache an image as a set of lines. Example: - out = in.linecache(tile_height=int, access=Union[str, Access], threaded=bool, persistent=bool) + out = in.linecache(tile_height=int, access=str | Access, threaded=bool, persistent=bool) :param tile_height: Tile height in pixels :type tile_height: int :param access: Expected access pattern - :type access: Union[str, Access] + :type access: str | Access :param threaded: Allow threaded access :type threaded: bool :param persistent: Keep cache between evaluations @@ -3458,12 +3458,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: logmat(sigma, min_ampl, separable=bool, precision=Union[str, Precision]) + .. staticmethod:: logmat(sigma, min_ampl, separable=bool, precision=str | Precision) Make a Laplacian of Gaussian image. Example: - out = pyvips.Image.logmat(sigma, min_ampl, separable=bool, precision=Union[str, Precision]) + out = pyvips.Image.logmat(sigma, min_ampl, separable=bool, precision=str | Precision) :param sigma: Radius of Gaussian :type sigma: float @@ -3472,16 +3472,16 @@ Autogenerated methods :param separable: Generate separable Gaussian :type separable: bool :param precision: Generate with this precision - :type precision: Union[str, Precision] + :type precision: str | Precision :rtype: Image :raises Error: - .. staticmethod:: magickload(filename, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: magickload(filename, density=str, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load file with ImageMagick7. Example: - out = pyvips.Image.magickload(filename, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.magickload(filename, density=str, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param filename: Filename to load from :type filename: str | Path @@ -3494,20 +3494,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: magickload_buffer(buffer, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: magickload_buffer(buffer, density=str, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load buffer with ImageMagick7. Example: - out = pyvips.Image.magickload_buffer(buffer, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.magickload_buffer(buffer, density=str, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -3520,20 +3520,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: magickload_source(source, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: magickload_source(source, density=str, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load source with ImageMagick7. Example: - out = pyvips.Image.magickload_source(source, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.magickload_source(source, density=str, page=int, n=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -3546,9 +3546,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -3612,12 +3612,12 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: mapim(index, interpolate=GObject, background=list[float], premultiplied=bool, extend=Union[str, Extend]) + .. method:: mapim(index, interpolate=GObject, background=list[float], premultiplied=bool, extend=str | Extend) Resample with a map image. Example: - out = in.mapim(index, interpolate=GObject, background=list[float], premultiplied=bool, extend=Union[str, Extend]) + out = in.mapim(index, interpolate=GObject, background=list[float], premultiplied=bool, extend=str | Extend) :param index: Index pixels with this :type index: Image @@ -3628,7 +3628,7 @@ Autogenerated methods :param premultiplied: Images have premultiplied alpha :type premultiplied: bool :param extend: How to generate the extra pixels - :type extend: Union[str, Extend] + :type extend: str | Extend :rtype: Image :raises Error: @@ -3966,7 +3966,7 @@ Autogenerated methods out = in.math(math) :param math: Math to perform - :type math: Union[str, OperationMath] + :type math: str | OperationMath :rtype: Image :raises Error: @@ -3980,7 +3980,7 @@ Autogenerated methods :param right: Right-hand image argument :type right: Image :param math2: Math to perform - :type math2: Union[str, OperationMath2] + :type math2: str | OperationMath2 :rtype: Image :raises Error: @@ -3992,27 +3992,27 @@ Autogenerated methods out = in.math2_const(math2, c) :param math2: Math to perform - :type math2: Union[str, OperationMath2] + :type math2: str | OperationMath2 :param c: Array of constants :type c: list[float] :rtype: Image :raises Error: - .. staticmethod:: matload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: matload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load mat from file. Example: - out = pyvips.Image.matload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.matload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4030,21 +4030,21 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: matrixload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: matrixload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load matrix. Example: - out = pyvips.Image.matrixload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.matrixload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4052,21 +4052,21 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: matrixload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: matrixload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load matrix. Example: - out = pyvips.Image.matrixload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.matrixload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -4208,7 +4208,7 @@ Autogenerated methods :param sec: Secondary image :type sec: Image :param direction: Horizontal or vertical merge - :type direction: Union[str, Direction] + :type direction: str | Direction :param dx: Horizontal displacement from sec to ref :type dx: int :param dy: Vertical displacement from sec to ref @@ -4262,7 +4262,7 @@ Autogenerated methods :param mask: Input matrix image :type mask: Image :param morph: Morphological operation to perform - :type morph: Union[str, OperationMorphology] + :type morph: str | OperationMorphology :rtype: Image :raises Error: @@ -4276,7 +4276,7 @@ Autogenerated methods :param sec: Secondary image :type sec: Image :param direction: Horizontal or vertical mosaic - :type direction: Union[str, Direction] + :type direction: str | Direction :param xref: Position of reference tie-point :type xref: int :param yref: Position of reference tie-point @@ -4318,7 +4318,7 @@ Autogenerated methods :param sec: Secondary image :type sec: Image :param direction: Horizontal or vertical mosaic - :type direction: Union[str, Direction] + :type direction: str | Direction :param xr1: Position of first reference tie-point :type xr1: int :param yr1: Position of first reference tie-point @@ -4372,21 +4372,21 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: niftiload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: niftiload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load NIfTI volume. Example: - out = pyvips.Image.niftiload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.niftiload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4394,32 +4394,32 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: niftiload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: niftiload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load NIfTI volumes. Example: - out = pyvips.Image.niftiload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.niftiload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: niftisave(filename, keep=int, background=list[float], page_height=int, profile=str) + .. method:: niftisave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to nifti file. Example: - in.niftisave(filename, keep=int, background=list[float], page_height=int, profile=str) + in.niftisave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path @@ -4434,21 +4434,21 @@ Autogenerated methods :rtype: list[] :raises Error: - .. staticmethod:: openexrload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: openexrload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load an OpenEXR image. Example: - out = pyvips.Image.openexrload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.openexrload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4456,12 +4456,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: openslideload(filename, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: openslideload(filename, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load file with OpenSlide. Example: - out = pyvips.Image.openslideload(filename, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.openslideload(filename, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -4478,9 +4478,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4488,12 +4488,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: openslideload_source(source, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: openslideload_source(source, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load source with OpenSlide. Example: - out = pyvips.Image.openslideload_source(source, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.openslideload_source(source, level=int, autocrop=bool, associated=str, attach_associated=bool, rgb=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -4510,20 +4510,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: pdfload(filename, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=Union[str, ForeignPdfPageBox], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: pdfload(filename, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=str | ForeignPdfPageBox, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load PDF from file (poppler). Example: - out = pyvips.Image.pdfload(filename, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=Union[str, ForeignPdfPageBox], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.pdfload(filename, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=str | ForeignPdfPageBox, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -4540,13 +4540,13 @@ Autogenerated methods :param password: Password to decrypt with :type password: str :param page_box: The region of the page to render - :type page_box: Union[str, ForeignPdfPageBox] + :type page_box: str | ForeignPdfPageBox :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4554,12 +4554,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: pdfload_buffer(buffer, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=Union[str, ForeignPdfPageBox], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: pdfload_buffer(buffer, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=str | ForeignPdfPageBox, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load PDF from buffer (poppler). Example: - out = pyvips.Image.pdfload_buffer(buffer, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=Union[str, ForeignPdfPageBox], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.pdfload_buffer(buffer, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=str | ForeignPdfPageBox, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -4576,24 +4576,24 @@ Autogenerated methods :param password: Password to decrypt with :type password: str :param page_box: The region of the page to render - :type page_box: Union[str, ForeignPdfPageBox] + :type page_box: str | ForeignPdfPageBox :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: pdfload_source(source, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=Union[str, ForeignPdfPageBox], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: pdfload_source(source, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=str | ForeignPdfPageBox, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load PDF from source (poppler). Example: - out = pyvips.Image.pdfload_source(source, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=Union[str, ForeignPdfPageBox], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.pdfload_source(source, page=int, n=int, dpi=float, scale=float, background=list[float], password=str, page_box=str | ForeignPdfPageBox, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -4610,13 +4610,13 @@ Autogenerated methods :param password: Password to decrypt with :type password: str :param page_box: The region of the page to render - :type page_box: Union[str, ForeignPdfPageBox] + :type page_box: str | ForeignPdfPageBox :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -4666,12 +4666,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: pngload(filename, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: pngload(filename, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load png from file. Example: - out = pyvips.Image.pngload(filename, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.pngload(filename, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -4680,9 +4680,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4690,12 +4690,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: pngload_buffer(buffer, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: pngload_buffer(buffer, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load png from buffer. Example: - out = pyvips.Image.pngload_buffer(buffer, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.pngload_buffer(buffer, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -4704,20 +4704,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: pngload_source(source, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: pngload_source(source, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load png from source. Example: - out = pyvips.Image.pngload_source(source, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.pngload_source(source, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -4726,9 +4726,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -4840,21 +4840,21 @@ Autogenerated methods :rtype: list[] :raises Error: - .. staticmethod:: ppmload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: ppmload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load ppm from file. Example: - out = pyvips.Image.ppmload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.ppmload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -4862,57 +4862,57 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: ppmload_buffer(buffer, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: ppmload_buffer(buffer, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load ppm from buffer. Example: - out = pyvips.Image.ppmload_buffer(buffer, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.ppmload_buffer(buffer, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: ppmload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: ppmload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load ppm from source. Example: - out = pyvips.Image.ppmload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.ppmload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: ppmsave(filename, format=Union[str, ForeignPpmFormat], ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: ppmsave(filename, format=str | ForeignPpmFormat, ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to ppm file. Example: - in.ppmsave(filename, format=Union[str, ForeignPpmFormat], ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.ppmsave(filename, format=str | ForeignPpmFormat, ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path :param format: Format to save in - :type format: Union[str, ForeignPpmFormat] + :type format: str | ForeignPpmFormat :param ascii: Save as ascii :type ascii: bool :param bitdepth: Set to 1 to write as a 1 bit image @@ -4928,17 +4928,17 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: ppmsave_target(target, format=Union[str, ForeignPpmFormat], ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: ppmsave_target(target, format=str | ForeignPpmFormat, ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save to ppm. Example: - in.ppmsave_target(target, format=Union[str, ForeignPpmFormat], ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.ppmsave_target(target, format=str | ForeignPpmFormat, ascii=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target :param format: Format to save in - :type format: Union[str, ForeignPpmFormat] + :type format: str | ForeignPpmFormat :param ascii: Save as ascii :type ascii: bool :param bitdepth: Set to 1 to write as a 1 bit image @@ -5032,21 +5032,21 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: radload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: radload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load a Radiance image from a file. Example: - out = pyvips.Image.radload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.radload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -5054,41 +5054,41 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: radload_buffer(buffer, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: radload_buffer(buffer, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load rad from buffer. Example: - out = pyvips.Image.radload_buffer(buffer, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.radload_buffer(buffer, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: radload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: radload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load rad from source. Example: - out = pyvips.Image.radload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.radload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -5168,12 +5168,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: rawload(filename, width, height, bands, offset=long, format=Union[str, BandFormat], interpretation=Union[str, Interpretation], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: rawload(filename, width, height, bands, offset=int, format=str | BandFormat, interpretation=str | Interpretation, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load raw data from a file. Example: - out = pyvips.Image.rawload(filename, width, height, bands, offset=long, format=Union[str, BandFormat], interpretation=Union[str, Interpretation], memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.rawload(filename, width, height, bands, offset=int, format=str | BandFormat, interpretation=str | Interpretation, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -5184,17 +5184,17 @@ Autogenerated methods :param bands: Number of bands in image :type bands: int :param offset: Offset in bytes from start of file - :type offset: long + :type offset: int :param format: Pixel format in image - :type format: Union[str, BandFormat] + :type format: str | BandFormat :param interpretation: Pixel interpretation - :type interpretation: Union[str, Interpretation] + :type interpretation: str | Interpretation :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -5272,51 +5272,51 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: reduce(hshrink, vshrink, kernel=Union[str, Kernel], gap=float) + .. method:: reduce(hshrink, vshrink, kernel=str | Kernel, gap=float) Reduce an image. Example: - out = in.reduce(hshrink, vshrink, kernel=Union[str, Kernel], gap=float) + out = in.reduce(hshrink, vshrink, kernel=str | Kernel, gap=float) :param hshrink: Horizontal shrink factor :type hshrink: float :param vshrink: Vertical shrink factor :type vshrink: float :param kernel: Resampling kernel - :type kernel: Union[str, Kernel] + :type kernel: str | Kernel :param gap: Reducing gap :type gap: float :rtype: Image :raises Error: - .. method:: reduceh(hshrink, kernel=Union[str, Kernel], gap=float) + .. method:: reduceh(hshrink, kernel=str | Kernel, gap=float) Shrink an image horizontally. Example: - out = in.reduceh(hshrink, kernel=Union[str, Kernel], gap=float) + out = in.reduceh(hshrink, kernel=str | Kernel, gap=float) :param hshrink: Horizontal shrink factor :type hshrink: float :param kernel: Resampling kernel - :type kernel: Union[str, Kernel] + :type kernel: str | Kernel :param gap: Reducing gap :type gap: float :rtype: Image :raises Error: - .. method:: reducev(vshrink, kernel=Union[str, Kernel], gap=float) + .. method:: reducev(vshrink, kernel=str | Kernel, gap=float) Shrink an image vertically. Example: - out = in.reducev(vshrink, kernel=Union[str, Kernel], gap=float) + out = in.reducev(vshrink, kernel=str | Kernel, gap=float) :param vshrink: Vertical shrink factor :type vshrink: float :param kernel: Resampling kernel - :type kernel: Union[str, Kernel] + :type kernel: str | Kernel :param gap: Reducing gap :type gap: float :rtype: Image @@ -5332,7 +5332,7 @@ Autogenerated methods :param right: Right-hand image argument :type right: Image :param relational: Relational to perform - :type relational: Union[str, OperationRelational] + :type relational: str | OperationRelational :rtype: Image :raises Error: @@ -5344,7 +5344,7 @@ Autogenerated methods out = in.relational_const(relational, c) :param relational: Relational to perform - :type relational: Union[str, OperationRelational] + :type relational: str | OperationRelational :param c: Array of constants :type c: list[float] :rtype: Image @@ -5402,17 +5402,17 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: resize(scale, kernel=Union[str, Kernel], gap=float, vscale=float) + .. method:: resize(scale, kernel=str | Kernel, gap=float, vscale=float) Resize an image. Example: - out = in.resize(scale, kernel=Union[str, Kernel], gap=float, vscale=float) + out = in.resize(scale, kernel=str | Kernel, gap=float, vscale=float) :param scale: Scale image by this factor :type scale: float :param kernel: Resampling kernel - :type kernel: Union[str, Kernel] + :type kernel: str | Kernel :param gap: Reducing gap :type gap: float :param vscale: Vertical scale image by this factor @@ -5428,19 +5428,19 @@ Autogenerated methods out = in.rot(angle) :param angle: Angle to rotate image - :type angle: Union[str, Angle] + :type angle: str | Angle :rtype: Image :raises Error: - .. method:: rot45(angle=Union[str, Angle45]) + .. method:: rot45(angle=str | Angle45) Rotate an image. Example: - out = in.rot45(angle=Union[str, Angle45]) + out = in.rot45(angle=str | Angle45) :param angle: Angle to rotate image - :type angle: Union[str, Angle45] + :type angle: str | Angle45 :rtype: Image :raises Error: @@ -5476,7 +5476,7 @@ Autogenerated methods out = in.round(round) :param round: Rounding operation to perform - :type round: Union[str, OperationRound] + :type round: str | OperationRound :rtype: Image :raises Error: @@ -5556,7 +5556,7 @@ Autogenerated methods :param height: Image height in pixels :type height: int :param shape: SDF shape to create - :type shape: Union[str, SdfShape] + :type shape: str | SdfShape :param r: Radius :type r: float :param a: Point a @@ -5702,19 +5702,19 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: smartcrop(width, height, interesting=Union[str, Interesting], premultiplied=bool, attention_x=bool, attention_y=bool) + .. method:: smartcrop(width, height, interesting=str | Interesting, premultiplied=bool, attention_x=bool, attention_y=bool) Extract an area from an image. Example: - out = input.smartcrop(width, height, interesting=Union[str, Interesting], premultiplied=bool) + out = input.smartcrop(width, height, interesting=str | Interesting, premultiplied=bool) :param width: Width of extract area :type width: int :param height: Height of extract area :type height: int :param interesting: How to measure interestingness - :type interesting: Union[str, Interesting] + :type interesting: str | Interesting :param premultiplied: Input image already has premultiplied alpha :type premultiplied: bool :param attention_x: enable output: Horizontal position of attention centre @@ -5828,12 +5828,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: svgload(filename, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: svgload(filename, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load SVG with rsvg. Example: - out = pyvips.Image.svgload(filename, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.svgload(filename, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -5850,9 +5850,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -5860,12 +5860,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: svgload_buffer(buffer, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: svgload_buffer(buffer, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load SVG with rsvg. Example: - out = pyvips.Image.svgload_buffer(buffer, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.svgload_buffer(buffer, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -5882,20 +5882,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: svgload_source(source, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: svgload_source(source, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load svg from source. Example: - out = pyvips.Image.svgload_source(source, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.svgload_source(source, dpi=float, scale=float, unlimited=bool, stylesheet=str, high_bitdepth=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -5912,9 +5912,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -5956,12 +5956,12 @@ Autogenerated methods :rtype: list[] or list[Dict[str, mixed]] :raises Error: - .. staticmethod:: text(text, font=str, width=int, height=int, align=Union[str, Align], justify=bool, dpi=int, spacing=int, fontfile=str, rgba=bool, wrap=Union[str, TextWrap], autofit_dpi=bool) + .. staticmethod:: text(text, font=str, width=int, height=int, align=str | Align, justify=bool, dpi=int, spacing=int, fontfile=str, rgba=bool, wrap=str | TextWrap, autofit_dpi=bool) Make a text image. Example: - out = pyvips.Image.text(text, font=str, width=int, height=int, align=Union[str, Align], justify=bool, dpi=int, spacing=int, fontfile=str, rgba=bool, wrap=Union[str, TextWrap]) + out = pyvips.Image.text(text, font=str, width=int, height=int, align=str | Align, justify=bool, dpi=int, spacing=int, fontfile=str, rgba=bool, wrap=str | TextWrap) :param text: Text to render :type text: str @@ -5972,7 +5972,7 @@ Autogenerated methods :param height: Maximum image height in pixels :type height: int :param align: Align on the low, centre or high edge - :type align: Union[str, Align] + :type align: str | Align :param justify: Justify lines :type justify: bool :param dpi: DPI to render at @@ -5984,18 +5984,18 @@ Autogenerated methods :param rgba: Enable RGBA output :type rgba: bool :param wrap: Wrap lines on word or character boundaries - :type wrap: Union[str, TextWrap] + :type wrap: str | TextWrap :param autofit_dpi: enable output: DPI selected by autofit :type autofit_dpi: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: thumbnail(filename, width, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. staticmethod:: thumbnail(filename, width, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) Generate thumbnail from file. Example: - out = pyvips.Image.thumbnail(filename, width, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + out = pyvips.Image.thumbnail(filename, width, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) :param filename: Filename to read from :type filename: str | Path @@ -6004,11 +6004,11 @@ Autogenerated methods :param height: Size to this height :type height: int :param size: Only upsize, only downsize, or both - :type size: Union[str, Size] + :type size: str | Size :param no_rotate: Don't use orientation tags to rotate image upright :type no_rotate: bool :param crop: Reduce to fill target rectangle, then crop - :type crop: Union[str, Interesting] + :type crop: str | Interesting :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile @@ -6016,18 +6016,18 @@ Autogenerated methods :param output_profile: Fallback output profile :type output_profile: str | Path :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :rtype: Image :raises Error: - .. staticmethod:: thumbnail_buffer(buffer, width, option_string=str, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. staticmethod:: thumbnail_buffer(buffer, width, option_string=str, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) Generate thumbnail from buffer. Example: - out = pyvips.Image.thumbnail_buffer(buffer, width, option_string=str, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + out = pyvips.Image.thumbnail_buffer(buffer, width, option_string=str, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -6038,11 +6038,11 @@ Autogenerated methods :param height: Size to this height :type height: int :param size: Only upsize, only downsize, or both - :type size: Union[str, Size] + :type size: str | Size :param no_rotate: Don't use orientation tags to rotate image upright :type no_rotate: bool :param crop: Reduce to fill target rectangle, then crop - :type crop: Union[str, Interesting] + :type crop: str | Interesting :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile @@ -6050,29 +6050,29 @@ Autogenerated methods :param output_profile: Fallback output profile :type output_profile: str | Path :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :rtype: Image :raises Error: - .. method:: thumbnail_image(width, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. method:: thumbnail_image(width, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) Generate thumbnail from image. Example: - out = in.thumbnail_image(width, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + out = in.thumbnail_image(width, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) :param width: Size to this width :type width: int :param height: Size to this height :type height: int :param size: Only upsize, only downsize, or both - :type size: Union[str, Size] + :type size: str | Size :param no_rotate: Don't use orientation tags to rotate image upright :type no_rotate: bool :param crop: Reduce to fill target rectangle, then crop - :type crop: Union[str, Interesting] + :type crop: str | Interesting :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile @@ -6080,18 +6080,18 @@ Autogenerated methods :param output_profile: Fallback output profile :type output_profile: str | Path :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :rtype: Image :raises Error: - .. staticmethod:: thumbnail_source(source, width, option_string=str, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. staticmethod:: thumbnail_source(source, width, option_string=str, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) Generate thumbnail from source. Example: - out = pyvips.Image.thumbnail_source(source, width, option_string=str, height=int, size=Union[str, Size], no_rotate=bool, crop=Union[str, Interesting], linear=bool, input_profile=str | Path, output_profile=str | Path, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + out = pyvips.Image.thumbnail_source(source, width, option_string=str, height=int, size=str | Size, no_rotate=bool, crop=str | Interesting, linear=bool, input_profile=str | Path, output_profile=str | Path, intent=str | Intent, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -6102,11 +6102,11 @@ Autogenerated methods :param height: Size to this height :type height: int :param size: Only upsize, only downsize, or both - :type size: Union[str, Size] + :type size: str | Size :param no_rotate: Don't use orientation tags to rotate image upright :type no_rotate: bool :param crop: Reduce to fill target rectangle, then crop - :type crop: Union[str, Interesting] + :type crop: str | Interesting :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile @@ -6114,18 +6114,18 @@ Autogenerated methods :param output_profile: Fallback output profile :type output_profile: str | Path :param intent: Rendering intent - :type intent: Union[str, Intent] + :type intent: str | Intent :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :rtype: Image :raises Error: - .. staticmethod:: tiffload(filename, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: tiffload(filename, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load tiff from file. Example: - out = pyvips.Image.tiffload(filename, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.tiffload(filename, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -6142,9 +6142,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -6152,12 +6152,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: tiffload_buffer(buffer, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: tiffload_buffer(buffer, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load tiff from buffer. Example: - out = pyvips.Image.tiffload_buffer(buffer, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.tiffload_buffer(buffer, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -6174,20 +6174,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: tiffload_source(source, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: tiffload_source(source, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load tiff from source. Example: - out = pyvips.Image.tiffload_source(source, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.tiffload_source(source, page=int, n=int, autorotate=bool, subifd=int, unlimited=bool, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -6204,29 +6204,29 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: tiffsave(filename, compression=Union[str, ForeignTiffCompression], Q=int, predictor=Union[str, ForeignTiffPredictor], tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=Union[str, ForeignTiffResunit], xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=Union[str, RegionShrink], level=int, lossless=bool, depth=Union[str, ForeignDzDepth], subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: tiffsave(filename, compression=str | ForeignTiffCompression, Q=int, predictor=str | ForeignTiffPredictor, tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=str | ForeignTiffResunit, xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=str | RegionShrink, level=int, lossless=bool, depth=str | ForeignDzDepth, subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to tiff file. Example: - in.tiffsave(filename, compression=Union[str, ForeignTiffCompression], Q=int, predictor=Union[str, ForeignTiffPredictor], tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=Union[str, ForeignTiffResunit], xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=Union[str, RegionShrink], level=int, lossless=bool, depth=Union[str, ForeignDzDepth], subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) + in.tiffsave(filename, compression=str | ForeignTiffCompression, Q=int, predictor=str | ForeignTiffPredictor, tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=str | ForeignTiffResunit, xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=str | RegionShrink, level=int, lossless=bool, depth=str | ForeignDzDepth, subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path :param compression: Compression for this file - :type compression: Union[str, ForeignTiffCompression] + :type compression: str | ForeignTiffCompression :param Q: Q factor :type Q: int :param predictor: Compression prediction - :type predictor: Union[str, ForeignTiffPredictor] + :type predictor: str | ForeignTiffPredictor :param tile: Write a tiled tiff :type tile: bool :param tile_width: Tile width in pixels @@ -6240,7 +6240,7 @@ Autogenerated methods :param bitdepth: Write as a 1, 2, 4 or 8 bit image :type bitdepth: int :param resunit: Resolution unit - :type resunit: Union[str, ForeignTiffResunit] + :type resunit: str | ForeignTiffResunit :param xres: Horizontal resolution in pixels/mm :type xres: float :param yres: Vertical resolution in pixels/mm @@ -6250,13 +6250,13 @@ Autogenerated methods :param properties: Write a properties document to IMAGEDESCRIPTION :type properties: bool :param region_shrink: Method to shrink regions - :type region_shrink: Union[str, RegionShrink] + :type region_shrink: str | RegionShrink :param level: Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level :type level: int :param lossless: Enable WEBP lossless mode :type lossless: bool :param depth: Pyramid depth - :type depth: Union[str, ForeignDzDepth] + :type depth: str | ForeignDzDepth :param subifd: Save pyr layers as sub-IFDs :type subifd: bool :param premultiply: Save with premultiplied alpha @@ -6272,19 +6272,19 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: tiffsave_buffer(compression=Union[str, ForeignTiffCompression], Q=int, predictor=Union[str, ForeignTiffPredictor], tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=Union[str, ForeignTiffResunit], xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=Union[str, RegionShrink], level=int, lossless=bool, depth=Union[str, ForeignDzDepth], subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: tiffsave_buffer(compression=str | ForeignTiffCompression, Q=int, predictor=str | ForeignTiffPredictor, tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=str | ForeignTiffResunit, xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=str | RegionShrink, level=int, lossless=bool, depth=str | ForeignDzDepth, subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to tiff buffer. Example: - buffer = in.tiffsave_buffer(compression=Union[str, ForeignTiffCompression], Q=int, predictor=Union[str, ForeignTiffPredictor], tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=Union[str, ForeignTiffResunit], xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=Union[str, RegionShrink], level=int, lossless=bool, depth=Union[str, ForeignDzDepth], subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) + buffer = in.tiffsave_buffer(compression=str | ForeignTiffCompression, Q=int, predictor=str | ForeignTiffPredictor, tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=str | ForeignTiffResunit, xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=str | RegionShrink, level=int, lossless=bool, depth=str | ForeignDzDepth, subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) :param compression: Compression for this file - :type compression: Union[str, ForeignTiffCompression] + :type compression: str | ForeignTiffCompression :param Q: Q factor :type Q: int :param predictor: Compression prediction - :type predictor: Union[str, ForeignTiffPredictor] + :type predictor: str | ForeignTiffPredictor :param tile: Write a tiled tiff :type tile: bool :param tile_width: Tile width in pixels @@ -6298,7 +6298,7 @@ Autogenerated methods :param bitdepth: Write as a 1, 2, 4 or 8 bit image :type bitdepth: int :param resunit: Resolution unit - :type resunit: Union[str, ForeignTiffResunit] + :type resunit: str | ForeignTiffResunit :param xres: Horizontal resolution in pixels/mm :type xres: float :param yres: Vertical resolution in pixels/mm @@ -6308,13 +6308,13 @@ Autogenerated methods :param properties: Write a properties document to IMAGEDESCRIPTION :type properties: bool :param region_shrink: Method to shrink regions - :type region_shrink: Union[str, RegionShrink] + :type region_shrink: str | RegionShrink :param level: Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level :type level: int :param lossless: Enable WEBP lossless mode :type lossless: bool :param depth: Pyramid depth - :type depth: Union[str, ForeignDzDepth] + :type depth: str | ForeignDzDepth :param subifd: Save pyr layers as sub-IFDs :type subifd: bool :param premultiply: Save with premultiplied alpha @@ -6330,21 +6330,21 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: tiffsave_target(target, compression=Union[str, ForeignTiffCompression], Q=int, predictor=Union[str, ForeignTiffPredictor], tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=Union[str, ForeignTiffResunit], xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=Union[str, RegionShrink], level=int, lossless=bool, depth=Union[str, ForeignDzDepth], subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: tiffsave_target(target, compression=str | ForeignTiffCompression, Q=int, predictor=str | ForeignTiffPredictor, tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=str | ForeignTiffResunit, xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=str | RegionShrink, level=int, lossless=bool, depth=str | ForeignDzDepth, subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to tiff target. Example: - in.tiffsave_target(target, compression=Union[str, ForeignTiffCompression], Q=int, predictor=Union[str, ForeignTiffPredictor], tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=Union[str, ForeignTiffResunit], xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=Union[str, RegionShrink], level=int, lossless=bool, depth=Union[str, ForeignDzDepth], subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) + in.tiffsave_target(target, compression=str | ForeignTiffCompression, Q=int, predictor=str | ForeignTiffPredictor, tile=bool, tile_width=int, tile_height=int, pyramid=bool, miniswhite=bool, bitdepth=int, resunit=str | ForeignTiffResunit, xres=float, yres=float, bigtiff=bool, properties=bool, region_shrink=str | RegionShrink, level=int, lossless=bool, depth=str | ForeignDzDepth, subifd=bool, premultiply=bool, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target :param compression: Compression for this file - :type compression: Union[str, ForeignTiffCompression] + :type compression: str | ForeignTiffCompression :param Q: Q factor :type Q: int :param predictor: Compression prediction - :type predictor: Union[str, ForeignTiffPredictor] + :type predictor: str | ForeignTiffPredictor :param tile: Write a tiled tiff :type tile: bool :param tile_width: Tile width in pixels @@ -6358,7 +6358,7 @@ Autogenerated methods :param bitdepth: Write as a 1, 2, 4 or 8 bit image :type bitdepth: int :param resunit: Resolution unit - :type resunit: Union[str, ForeignTiffResunit] + :type resunit: str | ForeignTiffResunit :param xres: Horizontal resolution in pixels/mm :type xres: float :param yres: Vertical resolution in pixels/mm @@ -6368,13 +6368,13 @@ Autogenerated methods :param properties: Write a properties document to IMAGEDESCRIPTION :type properties: bool :param region_shrink: Method to shrink regions - :type region_shrink: Union[str, RegionShrink] + :type region_shrink: str | RegionShrink :param level: Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level :type level: int :param lossless: Enable WEBP lossless mode :type lossless: bool :param depth: Pyramid depth - :type depth: Union[str, ForeignDzDepth] + :type depth: str | ForeignDzDepth :param subifd: Save pyr layers as sub-IFDs :type subifd: bool :param premultiply: Save with premultiplied alpha @@ -6390,12 +6390,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: tilecache(tile_width=int, tile_height=int, max_tiles=int, access=Union[str, Access], threaded=bool, persistent=bool) + .. method:: tilecache(tile_width=int, tile_height=int, max_tiles=int, access=str | Access, threaded=bool, persistent=bool) Cache an image as a set of tiles. Example: - out = in.tilecache(tile_width=int, tile_height=int, max_tiles=int, access=Union[str, Access], threaded=bool, persistent=bool) + out = in.tilecache(tile_width=int, tile_height=int, max_tiles=int, access=str | Access, threaded=bool, persistent=bool) :param tile_width: Tile width in pixels :type tile_width: int @@ -6404,7 +6404,7 @@ Autogenerated methods :param max_tiles: Maximum number of tiles to cache :type max_tiles: int :param access: Expected access pattern - :type access: Union[str, Access] + :type access: str | Access :param threaded: Allow threaded access :type threaded: bool :param persistent: Keep cache between evaluations @@ -6464,12 +6464,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: uhdrload(filename, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: uhdrload(filename, shrink=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load a UHDR image. Example: - out = pyvips.Image.uhdrload(filename, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.uhdrload(filename, shrink=int, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -6478,9 +6478,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -6488,12 +6488,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: uhdrload_buffer(buffer, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: uhdrload_buffer(buffer, shrink=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load a UHDR image. Example: - out = pyvips.Image.uhdrload_buffer(buffer, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.uhdrload_buffer(buffer, shrink=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -6502,20 +6502,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: uhdrload_source(source, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: uhdrload_source(source, shrink=int, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load a UHDR image. Example: - out = pyvips.Image.uhdrload_source(source, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.uhdrload_source(source, shrink=int, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -6524,9 +6524,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -6616,21 +6616,21 @@ Autogenerated methods :rtype: Image :raises Error: - .. staticmethod:: vipsload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: vipsload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load vips from file. Example: - out = pyvips.Image.vipsload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.vipsload(filename, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -6638,21 +6638,21 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: vipsload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: vipsload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load vips from source. Example: - out = pyvips.Image.vipsload_source(source, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.vipsload_source(source, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] @@ -6698,12 +6698,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. staticmethod:: webpload(filename, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool, flags=bool) + .. staticmethod:: webpload(filename, page=int, n=int, scale=float, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool, flags=bool) Load webp from file. Example: - out = pyvips.Image.webpload(filename, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) + out = pyvips.Image.webpload(filename, page=int, n=int, scale=float, memory=bool, access=str | Access, fail_on=str | FailOn, revalidate=bool) :param filename: Filename to load from :type filename: str | Path @@ -6716,9 +6716,9 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param revalidate: Don't use a cached result for this operation :type revalidate: bool :param flags: enable output: Flags for this file @@ -6726,12 +6726,12 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: webpload_buffer(buffer, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: webpload_buffer(buffer, page=int, n=int, scale=float, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load webp from buffer. Example: - out = pyvips.Image.webpload_buffer(buffer, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.webpload_buffer(buffer, page=int, n=int, scale=float, memory=bool, access=str | Access, fail_on=str | FailOn) :param buffer: Buffer to load from :type buffer: bytes @@ -6744,20 +6744,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. staticmethod:: webpload_source(source, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], flags=bool) + .. staticmethod:: webpload_source(source, page=int, n=int, scale=float, memory=bool, access=str | Access, fail_on=str | FailOn, flags=bool) Load webp from source. Example: - out = pyvips.Image.webpload_source(source, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) + out = pyvips.Image.webpload_source(source, page=int, n=int, scale=float, memory=bool, access=str | Access, fail_on=str | FailOn) :param source: Source to load from :type source: Source @@ -6770,20 +6770,20 @@ Autogenerated methods :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file - :type access: Union[str, Access] + :type access: str | Access :param fail_on: Error level to fail on - :type fail_on: Union[str, FailOn] + :type fail_on: str | FailOn :param flags: enable output: Flags for this file :type flags: bool :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: webpsave(filename, Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: webpsave(filename, Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save as WebP. Example: - in.webpsave(filename, Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.webpsave(filename, Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to :type filename: str | Path @@ -6794,7 +6794,7 @@ Autogenerated methods :param exact: Preserve color values from transparent pixels :type exact: bool :param preset: Preset for lossy compression - :type preset: Union[str, ForeignWebpPreset] + :type preset: str | ForeignWebpPreset :param smart_subsample: Enable high quality chroma subsampling :type smart_subsample: bool :param near_lossless: Enable preprocessing in lossless mode (uses Q) @@ -6828,12 +6828,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: webpsave_buffer(Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: webpsave_buffer(Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save as WebP. Example: - buffer = in.webpsave_buffer(Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + buffer = in.webpsave_buffer(Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param Q: Q factor :type Q: int @@ -6842,7 +6842,7 @@ Autogenerated methods :param exact: Preserve color values from transparent pixels :type exact: bool :param preset: Preset for lossy compression - :type preset: Union[str, ForeignWebpPreset] + :type preset: str | ForeignWebpPreset :param smart_subsample: Enable high quality chroma subsampling :type smart_subsample: bool :param near_lossless: Enable preprocessing in lossless mode (uses Q) @@ -6876,12 +6876,12 @@ Autogenerated methods :rtype: bytes :raises Error: - .. method:: webpsave_mime(Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: webpsave_mime(Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to webp mime. Example: - in.webpsave_mime(Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.webpsave_mime(Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param Q: Q factor :type Q: int @@ -6890,7 +6890,7 @@ Autogenerated methods :param exact: Preserve color values from transparent pixels :type exact: bool :param preset: Preset for lossy compression - :type preset: Union[str, ForeignWebpPreset] + :type preset: str | ForeignWebpPreset :param smart_subsample: Enable high quality chroma subsampling :type smart_subsample: bool :param near_lossless: Enable preprocessing in lossless mode (uses Q) @@ -6924,12 +6924,12 @@ Autogenerated methods :rtype: list[] :raises Error: - .. method:: webpsave_target(target, Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + .. method:: webpsave_target(target, Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save as WebP. Example: - in.webpsave_target(target, Q=int, lossless=bool, exact=bool, preset=Union[str, ForeignWebpPreset], smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) + in.webpsave_target(target, Q=int, lossless=bool, exact=bool, preset=str | ForeignWebpPreset, smart_subsample=bool, near_lossless=bool, alpha_q=int, min_size=bool, kmin=int, kmax=int, effort=int, target_size=int, mixed=bool, smart_deblock=bool, passes=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -6940,7 +6940,7 @@ Autogenerated methods :param exact: Preserve color values from transparent pixels :type exact: bool :param preset: Preset for lossy compression - :type preset: Union[str, ForeignWebpPreset] + :type preset: str | ForeignWebpPreset :param smart_subsample: Enable high quality chroma subsampling :type smart_subsample: bool :param near_lossless: Enable preprocessing in lossless mode (uses Q) diff --git a/pyvips/__init__.pyi b/pyvips/__init__.pyi index 93ac246..837dd2e 100644 --- a/pyvips/__init__.pyi +++ b/pyvips/__init__.pyi @@ -256,7 +256,6 @@ class Image(VipsObject): def scaleimage(self, *, log: bool = ..., exp: float = ...) -> Image: ... # Dynamically generated operations - def CICP2scRGB(self) -> Image: ... def CMC2LCh(self) -> Image: ... def CMYK2XYZ(self) -> Image: ... def HSV2sRGB(self) -> Image: ... @@ -330,11 +329,11 @@ class Image(VipsObject): def dE76(self, right: Image) -> Image: ... def dECMC(self, right: Image) -> Image: ... @staticmethod - def dcrawload(filename: str | Path, *, bitdepth: int = ..., half_size: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def dcrawload(filename: str | Path, *, bitdepth: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def dcrawload_buffer(buffer: _BufferLike, *, bitdepth: int = ..., half_size: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def dcrawload_buffer(buffer: _BufferLike, *, bitdepth: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def dcrawload_source(source: Source, *, bitdepth: int = ..., half_size: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def dcrawload_source(source: Source, *, bitdepth: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... def deviate(self) -> float: ... def divide(self, right: Image) -> Image: ... def draw_circle(self, ink: list[float], cx: int, cy: int, radius: int, *, fill: bool = ...) -> Image: ... @@ -446,9 +445,9 @@ class Image(VipsObject): def jxlload_buffer(buffer: _BufferLike, *, page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod def jxlload_source(source: Source, *, page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - def jxlsave(self, filename: str | Path, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., interlace: bool = ..., progressive: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... - def jxlsave_buffer(self, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., interlace: bool = ..., progressive: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... - def jxlsave_target(self, target: Target, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., interlace: bool = ..., progressive: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def jxlsave(self, filename: str | Path, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def jxlsave_buffer(self, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def jxlsave_target(self, target: Target, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... def labelregions(self, segments: bool = ...) -> Image: ... def linear(self, a: list[float], b: list[float], *, uchar: bool = ...) -> Image: ... def linecache(self, *, tile_height: int = ..., access: str | Access = ..., threaded: bool = ..., persistent: bool = ...) -> Image: ... @@ -528,7 +527,6 @@ class Image(VipsObject): @staticmethod def pdfload_source(source: Source, *, page: int = ..., n: int = ..., dpi: float = ..., scale: float = ..., background: list[float] = ..., password: str = ..., page_box: str | ForeignPdfPageBox = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... def percent(self, percent: float) -> int: ... - def percent_lum(self, percent: float, *, max_: float = ...) -> float: ... @staticmethod def perlin(width: int, height: int, *, cell_size: int = ..., uchar: bool = ..., seed: int = ...) -> Image: ... def phasecor(self, in2: Image) -> Image: ... @@ -549,7 +547,7 @@ class Image(VipsObject): def ppmload_source(source: Source, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... def ppmsave(self, filename: str | Path, *, format: str | ForeignPpmFormat = ..., ascii: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... def ppmsave_target(self, target: Target, *, format: str | ForeignPpmFormat = ..., ascii: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... - def premultiply(self, *, max_alpha: float = ..., uchar: bool = ...) -> Image: ... + def premultiply(self, *, max_alpha: float = ...) -> Image: ... def prewitt(self) -> Image: ... def profile(self) -> tuple[Image, Image]: ... @staticmethod @@ -590,7 +588,6 @@ class Image(VipsObject): def sRGB2HSV(self) -> Image: ... def sRGB2scRGB(self) -> Image: ... def scRGB2BW(self, *, depth: int = ...) -> Image: ... - def scRGB2CICP(self, *, colour_primaries: str | CICPColourPrimaries = ..., transfer_characteristics: str | CICPTransferCharacteristics = ..., matrix_coefficients: str | CICPMatrixCoefficients = ..., depth: int = ...) -> Image: ... def scRGB2XYZ(self) -> Image: ... def scRGB2sRGB(self, *, depth: int = ...) -> Image: ... def scharr(self) -> Image: ... @@ -605,7 +602,7 @@ class Image(VipsObject): def similarity(self, *, scale: float = ..., angle: float = ..., interpolate: Interpolate = ..., background: list[float] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ...) -> Image: ... @staticmethod def sines(width: int, height: int, *, uchar: bool = ..., hfreq: float = ..., vfreq: float = ...) -> Image: ... - def smartcrop(self, width: int, height: int, *, interesting: str | Interesting = ..., interesting_x: int = ..., interesting_y: int = ..., premultiplied: bool = ..., attention_x: bool = ..., attention_y: bool = ...) -> Image: ... + def smartcrop(self, width: int, height: int, *, interesting: str | Interesting = ..., premultiplied: bool = ..., attention_x: bool = ..., attention_y: bool = ...) -> Image: ... def sobel(self) -> Image: ... def spcor(self, ref: Image) -> Image: ... def spectrum(self) -> Image: ... @@ -628,12 +625,12 @@ class Image(VipsObject): @staticmethod def text(text: str, *, font: str = ..., width: int = ..., height: int = ..., align: str | Align = ..., justify: bool = ..., dpi: int = ..., spacing: int = ..., fontfile: str = ..., rgba: bool = ..., wrap: str | TextWrap = ..., autofit_dpi: bool = ...) -> Image: ... @staticmethod - def thumbnail(filename: str | Path, width: int, *, height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., interesting_x: int = ..., interesting_y: int = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + def thumbnail(filename: str | Path, width: int, *, height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... @staticmethod - def thumbnail_buffer(buffer: _BufferLike, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., interesting_x: int = ..., interesting_y: int = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... - def thumbnail_image(self, width: int, *, height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., interesting_x: int = ..., interesting_y: int = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + def thumbnail_buffer(buffer: _BufferLike, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + def thumbnail_image(self, width: int, *, height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... @staticmethod - def thumbnail_source(source: Source, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., interesting_x: int = ..., interesting_y: int = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + def thumbnail_source(source: Source, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... @staticmethod def tiffload(filename: str | Path, *, page: int = ..., n: int = ..., autorotate: bool = ..., subifd: int = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod @@ -648,7 +645,16 @@ class Image(VipsObject): def tonelut(*, in_max: int = ..., out_max: int = ..., Lb: float = ..., Lw: float = ..., Ps: float = ..., Pm: float = ..., Ph: float = ..., S: float = ..., M: float = ..., H: float = ...) -> Image: ... def transpose3d(self, *, page_height: int = ...) -> Image: ... def uhdr2scRGB(self) -> Image: ... - def unpremultiply(self, *, max_alpha: float = ..., alpha_band: int = ..., uchar: bool = ...) -> Image: ... + @staticmethod + def uhdrload(filename: str | Path, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + def uhdrload_buffer(buffer: _BufferLike, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + def uhdrload_source(source: Source, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def uhdrsave(self, filename: str | Path, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def uhdrsave_buffer(self, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def uhdrsave_target(self, target: Target, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def unpremultiply(self, *, max_alpha: float = ..., alpha_band: int = ...) -> Image: ... @staticmethod def vipsload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod