diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aff7d60..8448893 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: matrix: # Only test supported Python versions: # https://endoflife.date/python - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.9"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.10"] steps: - name: Checkout code @@ -36,11 +36,9 @@ jobs: run: | # Pin mypy to <1.19 due to librt dependency in 1.19+ # which is not available on PyPy 3.9 - pip install "mypy<1.19" + pip install "mypy<1.19" "numpy" "pillow" "requests" "types-requests" mypy pyvips/__init__.pyi --no-error-summary - mypy examples/affine.py examples/convolve.py examples/try5.py examples/watermark.py \ - examples/annotate-animation.py examples/join-animation.py examples/progress.py \ - --no-error-summary + mypy examples/*.py --no-error-summary - name: Install tox and any other packages run: pip install tox diff --git a/doc/vimage.rst b/doc/vimage.rst index ade13ef..30afb11 100644 --- a/doc/vimage.rst +++ b/doc/vimage.rst @@ -726,7 +726,7 @@ Autogenerated methods out = pyvips.Image.analyzeload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -1256,7 +1256,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param skip: Skip this many lines at the start of the file :type skip: int :param lines: Read this many lines from the file @@ -1306,15 +1306,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: csvsave(filename, separator=str, keep=int, background=list[float], page_height=int, profile=str) + .. method:: csvsave(filename, separator=str, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to csv. Example: - in.csvsave(filename, separator=str, keep=int, background=list[float], page_height=int, profile=str) + in.csvsave(filename, separator=str, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param separator: Separator characters :type separator: str :param keep: Which metadata to retain @@ -1324,16 +1324,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: csvsave_target(target, separator=str, keep=int, background=list[float], page_height=int, profile=str) + .. method:: csvsave_target(target, separator=str, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to csv. Example: - in.csvsave_target(target, separator=str, keep=int, background=list[float], page_height=int, profile=str) + in.csvsave_target(target, separator=str, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -1346,7 +1346,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -1394,7 +1394,7 @@ Autogenerated methods out = pyvips.Image.dcrawload(filename, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param bitdepth: Number of bits per pixel :type bitdepth: int :param memory: Force open via memory @@ -1418,7 +1418,7 @@ Autogenerated methods out = pyvips.Image.dcrawload_buffer(buffer, bitdepth=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param bitdepth: Number of bits per pixel :type bitdepth: int :param memory: Force open via memory @@ -1620,15 +1620,15 @@ 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) + .. 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) 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) + 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) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param imagename: Image name :type imagename: str :param layout: Directory layout @@ -1664,16 +1664,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param imagename: Image name :type imagename: str @@ -1710,16 +1710,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :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) + .. 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) 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) + 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) :param target: Target to save to :type target: Target @@ -1758,7 +1758,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -1892,7 +1892,7 @@ Autogenerated methods out = pyvips.Image.fitsload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -1926,15 +1926,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: fitssave(filename, keep=int, background=list[float], page_height=int, profile=str) + .. method:: fitssave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to fits file. Example: - in.fitssave(filename, keep=int, background=list[float], page_height=int, profile=str) + in.fitssave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -1942,7 +1942,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -2110,7 +2110,7 @@ Autogenerated methods out = pyvips.Image.gifload(filename, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param n: Number of pages to load, -1 for all :type n: int :param page: First page to load @@ -2136,7 +2136,7 @@ Autogenerated methods out = pyvips.Image.gifload_buffer(buffer, n=int, page=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param n: Number of pages to load, -1 for all :type n: int :param page: First page to load @@ -2176,15 +2176,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: gifsave(filename, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str) + .. method:: gifsave(filename, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str | Path) Save as gif. Example: - in.gifsave(filename, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str) + in.gifsave(filename, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param dither: Amount of dithering :type dither: float :param effort: Quantisation effort @@ -2208,16 +2208,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: gifsave_buffer(dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str) + .. method:: gifsave_buffer(dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str | Path) Save as gif. Example: - buffer = in.gifsave_buffer(dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str) + buffer = in.gifsave_buffer(dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str | Path) :param dither: Amount of dithering :type dither: float @@ -2242,16 +2242,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: - .. method:: gifsave_target(target, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str) + .. method:: gifsave_target(target, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str | Path) Save as gif. Example: - in.gifsave_target(target, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str) + in.gifsave_target(target, dither=float, effort=int, bitdepth=int, interframe_maxerror=float, reuse=bool, interpalette_maxerror=float, interlace=bool, keep_duplicate_frames=bool, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -2278,7 +2278,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -2356,7 +2356,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -2386,7 +2386,7 @@ Autogenerated methods 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]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -2434,15 +2434,15 @@ Autogenerated methods :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) + .. 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) 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) + 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) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param Q: Q factor :type Q: int :param bitdepth: Number of bits per pixel @@ -2466,16 +2466,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param Q: Q factor :type Q: int @@ -2500,16 +2500,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :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) + .. 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) 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) + 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) :param target: Target to save to :type target: Target @@ -2536,7 +2536,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -2698,12 +2698,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: icc_export(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, output_profile=str, depth=int) + .. method:: icc_export(pcs=Union[str, PCS], intent=Union[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, depth=int) + out = in.icc_export(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, output_profile=str | Path, depth=int) :param pcs: Set Profile Connection Space :type pcs: Union[str, PCS] @@ -2712,18 +2712,18 @@ Autogenerated methods :param black_point_compensation: Enable black point compensation :type black_point_compensation: bool :param output_profile: Filename to load output profile from - :type output_profile: str + :type output_profile: str | Path :param depth: Output device space depth in bits :type depth: int :rtype: Image :raises Error: - .. method:: icc_import(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, embedded=bool, input_profile=str) + .. method:: icc_import(pcs=Union[str, PCS], intent=Union[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) + out = in.icc_import(pcs=Union[str, PCS], intent=Union[str, Intent], black_point_compensation=bool, embedded=bool, input_profile=str | Path) :param pcs: Set Profile Connection Space :type pcs: Union[str, PCS] @@ -2734,19 +2734,19 @@ Autogenerated methods :param embedded: Use embedded input profile, if available :type embedded: bool :param input_profile: Filename to load input profile from - :type input_profile: str + :type input_profile: str | Path :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, depth=int) + .. 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) 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, depth=int) + 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) :param output_profile: Filename to load output profile from - :type output_profile: str + :type output_profile: str | Path :param pcs: Set Profile Connection Space :type pcs: Union[str, PCS] :param intent: Rendering intent @@ -2756,7 +2756,7 @@ Autogenerated methods :param embedded: Use embedded input profile, if available :type embedded: bool :param input_profile: Filename to load input profile from - :type input_profile: str + :type input_profile: str | Path :param depth: Output device space depth in bits :type depth: int :rtype: Image @@ -2862,7 +2862,7 @@ Autogenerated methods out = pyvips.Image.jp2kload(filename, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param page: Load this page from the image :type page: int :param oneshot: Load images a frame at a time @@ -2888,7 +2888,7 @@ Autogenerated methods out = pyvips.Image.jp2kload_buffer(buffer, page=int, oneshot=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param page: Load this page from the image :type page: int :param oneshot: Load images a frame at a time @@ -2928,15 +2928,15 @@ Autogenerated methods :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) + .. 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) 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) + 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) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param tile_width: Tile width in pixels :type tile_width: int :param tile_height: Tile height in pixels @@ -2954,16 +2954,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param tile_width: Tile width in pixels :type tile_width: int @@ -2982,16 +2982,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :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) + .. 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) 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) + 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) :param target: Target to save to :type target: Target @@ -3012,7 +3012,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -3024,7 +3024,7 @@ Autogenerated methods out = pyvips.Image.jpegload(filename, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param shrink: Shrink factor on load :type shrink: int :param autorotate: Rotate image using exif orientation @@ -3052,7 +3052,7 @@ Autogenerated methods out = pyvips.Image.jpegload_buffer(buffer, shrink=int, autorotate=bool, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param shrink: Shrink factor on load :type shrink: int :param autorotate: Rotate image using exif orientation @@ -3096,15 +3096,15 @@ Autogenerated methods :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) + .. 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) 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) + 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) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param Q: Q factor :type Q: int :param optimize_coding: Compute optimal Huffman coding tables @@ -3130,16 +3130,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param Q: Q factor :type Q: int @@ -3166,16 +3166,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :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) + .. 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) 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) + 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) :param Q: Q factor :type Q: int @@ -3202,16 +3202,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param target: Target to save to :type target: Target @@ -3240,7 +3240,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -3252,7 +3252,7 @@ Autogenerated methods out = pyvips.Image.jxlload(filename, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -3278,7 +3278,7 @@ Autogenerated methods out = pyvips.Image.jxlload_buffer(buffer, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -3318,15 +3318,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: jxlsave(filename, tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: jxlsave(filename, tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in JPEG-XL format. Example: - in.jxlsave(filename, tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + in.jxlsave(filename, tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param tier: Decode speed tier :type tier: int :param distance: Target butteraugli distance @@ -3346,16 +3346,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: jxlsave_buffer(tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: jxlsave_buffer(tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in JPEG-XL format. Example: - buffer = in.jxlsave_buffer(tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + buffer = in.jxlsave_buffer(tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param tier: Decode speed tier :type tier: int @@ -3376,16 +3376,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: - .. method:: jxlsave_target(target, tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: jxlsave_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) Save image in JPEG-XL format. Example: - in.jxlsave_target(target, tier=int, distance=float, effort=int, lossless=bool, Q=int, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + in.jxlsave_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) :param target: Target to save to :type target: Target @@ -3408,7 +3408,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -3484,7 +3484,7 @@ Autogenerated methods out = pyvips.Image.magickload(filename, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param density: Canvas resolution for rendering vector formats like SVG :type density: str :param page: First page to load @@ -3510,7 +3510,7 @@ Autogenerated methods out = pyvips.Image.magickload_buffer(buffer, density=str, page=int, n=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param density: Canvas resolution for rendering vector formats like SVG :type density: str :param page: First page to load @@ -3554,15 +3554,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: magicksave(filename, format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: magicksave(filename, format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save file with ImageMagick. Example: - in.magicksave(filename, format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + in.magicksave(filename, format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param format: Format to save in :type format: str :param quality: Quality to use @@ -3580,16 +3580,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: magicksave_buffer(format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: magicksave_buffer(format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to magick buffer. Example: - buffer = in.magicksave_buffer(format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str) + buffer = in.magicksave_buffer(format=str, quality=int, optimize_gif_frames=bool, optimize_gif_transparency=bool, bitdepth=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param format: Format to save in :type format: str @@ -3608,8 +3608,8 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: .. method:: mapim(index, interpolate=GObject, background=list[float], premultiplied=bool, extend=Union[str, Extend]) @@ -4006,7 +4006,7 @@ Autogenerated methods out = pyvips.Image.matload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -4038,7 +4038,7 @@ Autogenerated methods out = pyvips.Image.matrixload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -4084,12 +4084,12 @@ Autogenerated methods :rtype: Image :raises Error: - .. method:: matrixprint(keep=int, background=list[float], page_height=int, profile=str) + .. method:: matrixprint(keep=int, background=list[float], page_height=int, profile=str | Path) Print matrix. Example: - in.matrixprint(keep=int, background=list[float], page_height=int, profile=str) + in.matrixprint(keep=int, background=list[float], page_height=int, profile=str | Path) :param keep: Which metadata to retain :type keep: int @@ -4098,19 +4098,19 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: matrixsave(filename, keep=int, background=list[float], page_height=int, profile=str) + .. method:: matrixsave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to matrix. Example: - in.matrixsave(filename, keep=int, background=list[float], page_height=int, profile=str) + in.matrixsave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -4118,16 +4118,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: matrixsave_target(target, keep=int, background=list[float], page_height=int, profile=str) + .. method:: matrixsave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to matrix. Example: - in.matrixsave_target(target, keep=int, background=list[float], page_height=int, profile=str) + in.matrixsave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -4138,7 +4138,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -4380,7 +4380,7 @@ Autogenerated methods out = pyvips.Image.niftiload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -4422,7 +4422,7 @@ Autogenerated methods in.niftisave(filename, keep=int, background=list[float], page_height=int, profile=str) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -4430,7 +4430,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -4442,7 +4442,7 @@ Autogenerated methods out = pyvips.Image.openexrload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -4464,7 +4464,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param level: Load this level from the file :type level: int :param autocrop: Crop to image bounds @@ -4526,7 +4526,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -4562,7 +4562,7 @@ Autogenerated methods 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]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -4674,7 +4674,7 @@ Autogenerated methods out = pyvips.Image.pngload(filename, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param unlimited: Remove all denial of service limits :type unlimited: bool :param memory: Force open via memory @@ -4698,7 +4698,7 @@ Autogenerated methods out = pyvips.Image.pngload_buffer(buffer, unlimited=bool, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param unlimited: Remove all denial of service limits :type unlimited: bool :param memory: Force open via memory @@ -4734,15 +4734,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: pngsave(filename, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: pngsave(filename, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to file as png. Example: - in.pngsave(filename, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str) + in.pngsave(filename, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param compression: Compression factor :type compression: int :param interlace: Interlace image @@ -4766,16 +4766,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: pngsave_buffer(compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: pngsave_buffer(compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to buffer as png. Example: - buffer = in.pngsave_buffer(compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str) + buffer = in.pngsave_buffer(compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param compression: Compression factor :type compression: int @@ -4800,16 +4800,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: - .. method:: pngsave_target(target, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: pngsave_target(target, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to target as PNG. Example: - in.pngsave_target(target, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str) + in.pngsave_target(target, compression=int, interlace=bool, filter=int, palette=bool, Q=int, dither=float, bitdepth=int, effort=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -4836,7 +4836,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -4848,7 +4848,7 @@ Autogenerated methods out = pyvips.Image.ppmload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -4870,7 +4870,7 @@ Autogenerated methods out = pyvips.Image.ppmload_buffer(buffer, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -4902,15 +4902,15 @@ Autogenerated methods :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) + .. method:: ppmsave(filename, format=Union[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) + in.ppmsave(filename, format=Union[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 + :type filename: str | Path :param format: Format to save in :type format: Union[str, ForeignPpmFormat] :param ascii: Save as ascii @@ -4924,16 +4924,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. method:: ppmsave_target(target, format=Union[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) + in.ppmsave_target(target, format=Union[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 @@ -4950,7 +4950,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -4995,7 +4995,7 @@ Autogenerated methods :param name: Profile name :type name: str - :rtype: str + :rtype: bytes :raises Error: .. method:: project() @@ -5040,7 +5040,7 @@ Autogenerated methods out = pyvips.Image.radload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -5062,7 +5062,7 @@ Autogenerated methods out = pyvips.Image.radload_buffer(buffer, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -5094,15 +5094,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: radsave(filename, keep=int, background=list[float], page_height=int, profile=str) + .. method:: radsave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to Radiance file. Example: - in.radsave(filename, keep=int, background=list[float], page_height=int, profile=str) + in.radsave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -5110,16 +5110,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: radsave_buffer(keep=int, background=list[float], page_height=int, profile=str) + .. method:: radsave_buffer(keep=int, background=list[float], page_height=int, profile=str | Path) Save image to Radiance buffer. Example: - buffer = in.radsave_buffer(keep=int, background=list[float], page_height=int, profile=str) + buffer = in.radsave_buffer(keep=int, background=list[float], page_height=int, profile=str | Path) :param keep: Which metadata to retain :type keep: int @@ -5128,16 +5128,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: - .. method:: radsave_target(target, keep=int, background=list[float], page_height=int, profile=str) + .. method:: radsave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to Radiance target. Example: - in.radsave_target(target, keep=int, background=list[float], page_height=int, profile=str) + in.radsave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -5148,7 +5148,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -5176,7 +5176,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param width: Image width in pixels :type width: int :param height: Image height in pixels @@ -5202,15 +5202,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: rawsave(filename, keep=int, background=list[float], page_height=int, profile=str) + .. method:: rawsave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to raw file. Example: - in.rawsave(filename, keep=int, background=list[float], page_height=int, profile=str) + in.rawsave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -5218,16 +5218,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: rawsave_buffer(keep=int, background=list[float], page_height=int, profile=str) + .. method:: rawsave_buffer(keep=int, background=list[float], page_height=int, profile=str | Path) Write raw image to buffer. Example: - buffer = in.rawsave_buffer(keep=int, background=list[float], page_height=int, profile=str) + buffer = in.rawsave_buffer(keep=int, background=list[float], page_height=int, profile=str | Path) :param keep: Which metadata to retain :type keep: int @@ -5236,16 +5236,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: - .. method:: rawsave_target(target, keep=int, background=list[float], page_height=int, profile=str) + .. method:: rawsave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) Write raw image to target. Example: - in.rawsave_target(target, keep=int, background=list[float], page_height=int, profile=str) + in.rawsave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -5256,7 +5256,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -5836,7 +5836,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param dpi: Render at this DPI :type dpi: float :param scale: Scale output by this factor @@ -5868,7 +5868,7 @@ Autogenerated methods 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]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param dpi: Render at this DPI :type dpi: float :param scale: Scale output by this factor @@ -5990,15 +5990,15 @@ Autogenerated methods :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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. 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]) 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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + 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]) :param filename: Filename to read from - :type filename: str + :type filename: str | Path :param width: Size to this width :type width: int :param height: Size to this height @@ -6012,9 +6012,9 @@ Autogenerated methods :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile - :type input_profile: str + :type input_profile: str | Path :param output_profile: Fallback output profile - :type output_profile: str + :type output_profile: str | Path :param intent: Rendering intent :type intent: Union[str, Intent] :param fail_on: Error level to fail on @@ -6022,15 +6022,15 @@ Autogenerated methods :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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. 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]) 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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + 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]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param width: Size to this width :type width: int :param option_string: Options that are passed on to the underlying loader @@ -6046,9 +6046,9 @@ Autogenerated methods :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile - :type input_profile: str + :type input_profile: str | Path :param output_profile: Fallback output profile - :type output_profile: str + :type output_profile: str | Path :param intent: Rendering intent :type intent: Union[str, Intent] :param fail_on: Error level to fail on @@ -6056,12 +6056,12 @@ Autogenerated methods :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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. 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]) 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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + 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]) :param width: Size to this width :type width: int @@ -6076,9 +6076,9 @@ Autogenerated methods :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile - :type input_profile: str + :type input_profile: str | Path :param output_profile: Fallback output profile - :type output_profile: str + :type output_profile: str | Path :param intent: Rendering intent :type intent: Union[str, Intent] :param fail_on: Error level to fail on @@ -6086,12 +6086,12 @@ Autogenerated methods :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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + .. 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]) 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, output_profile=str, intent=Union[str, Intent], fail_on=Union[str, FailOn]) + 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]) :param source: Source to load from :type source: Source @@ -6110,9 +6110,9 @@ Autogenerated methods :param linear: Reduce in linear light :type linear: bool :param input_profile: Fallback input profile - :type input_profile: str + :type input_profile: str | Path :param output_profile: Fallback output profile - :type output_profile: str + :type output_profile: str | Path :param intent: Rendering intent :type intent: Union[str, Intent] :param fail_on: Error level to fail on @@ -6128,7 +6128,7 @@ Autogenerated methods 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) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -6160,7 +6160,7 @@ Autogenerated methods 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]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -6212,15 +6212,15 @@ Autogenerated methods :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) + .. 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) 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) + 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) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param compression: Compression for this file :type compression: Union[str, ForeignTiffCompression] :param Q: Q factor @@ -6268,16 +6268,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param compression: Compression for this file :type compression: Union[str, ForeignTiffCompression] @@ -6326,16 +6326,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :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) + .. 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) 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) + 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) :param target: Target to save to :type target: Target @@ -6386,7 +6386,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -6472,7 +6472,7 @@ Autogenerated methods out = pyvips.Image.uhdrload(filename, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param shrink: Shrink factor on load :type shrink: int :param memory: Force open via memory @@ -6496,7 +6496,7 @@ Autogenerated methods out = pyvips.Image.uhdrload_buffer(buffer, shrink=int, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param shrink: Shrink factor on load :type shrink: int :param memory: Force open via memory @@ -6532,17 +6532,19 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: uhdrsave(filename, Q=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: uhdrsave(filename, Q=int, gainmap_scale_factor=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in UltraHDR format. Example: - in.uhdrsave(filename, Q=int, keep=int, background=list[float], page_height=int, profile=str) + in.uhdrsave(filename, Q=int, gainmap_scale_factor=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param Q: Q factor :type Q: int + :param gainmap_scale_factor: The scale factor of base image to gainmap image + :type gainmap_scale_factor: int :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -6550,19 +6552,21 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: uhdrsave_buffer(Q=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: uhdrsave_buffer(Q=int, gainmap_scale_factor=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in UltraHDR format. Example: - buffer = in.uhdrsave_buffer(Q=int, keep=int, background=list[float], page_height=int, profile=str) + buffer = in.uhdrsave_buffer(Q=int, gainmap_scale_factor=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param Q: Q factor :type Q: int + :param gainmap_scale_factor: The scale factor of base image to gainmap image + :type gainmap_scale_factor: int :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -6570,21 +6574,23 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :rtype: bytes :raises Error: - .. method:: uhdrsave_target(target, Q=int, keep=int, background=list[float], page_height=int, profile=str) + .. method:: uhdrsave_target(target, Q=int, gainmap_scale_factor=int, keep=int, background=list[float], page_height=int, profile=str | Path) Save image in UltraHDR format. Example: - in.uhdrsave_target(target, Q=int, keep=int, background=list[float], page_height=int, profile=str) + in.uhdrsave_target(target, Q=int, gainmap_scale_factor=int, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target :param Q: Q factor :type Q: int + :param gainmap_scale_factor: The scale factor of base image to gainmap image + :type gainmap_scale_factor: int :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -6592,7 +6598,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -6618,7 +6624,7 @@ Autogenerated methods out = pyvips.Image.vipsload(filename, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param memory: Force open via memory :type memory: bool :param access: Required access pattern for this file @@ -6652,15 +6658,15 @@ Autogenerated methods :rtype: Image or list[Image, Dict[str, mixed]] :raises Error: - .. method:: vipssave(filename, keep=int, background=list[float], page_height=int, profile=str) + .. method:: vipssave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to file in vips format. Example: - in.vipssave(filename, keep=int, background=list[float], page_height=int, profile=str) + in.vipssave(filename, keep=int, background=list[float], page_height=int, profile=str | Path) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param keep: Which metadata to retain :type keep: int :param background: Background value @@ -6668,16 +6674,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: - .. method:: vipssave_target(target, keep=int, background=list[float], page_height=int, profile=str) + .. method:: vipssave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) Save image to target in vips format. Example: - in.vipssave_target(target, keep=int, background=list[float], page_height=int, profile=str) + in.vipssave_target(target, keep=int, background=list[float], page_height=int, profile=str | Path) :param target: Target to save to :type target: Target @@ -6688,7 +6694,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: @@ -6700,7 +6706,7 @@ Autogenerated methods out = pyvips.Image.webpload(filename, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn], revalidate=bool) :param filename: Filename to load from - :type filename: str + :type filename: str | Path :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -6728,7 +6734,7 @@ Autogenerated methods out = pyvips.Image.webpload_buffer(buffer, page=int, n=int, scale=float, memory=bool, access=Union[str, Access], fail_on=Union[str, FailOn]) :param buffer: Buffer to load from - :type buffer: str + :type buffer: bytes :param page: First page to load :type page: int :param n: Number of pages to load, -1 for all @@ -6772,15 +6778,15 @@ Autogenerated methods :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) + .. 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) 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) + 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) :param filename: Filename to save to - :type filename: str + :type filename: str | Path :param Q: Q factor :type Q: int :param lossless: Enable lossless compression @@ -6818,16 +6824,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param Q: Q factor :type Q: int @@ -6866,16 +6872,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str - :rtype: str + :type profile: str | Path + :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) + .. 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) 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) + 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) :param Q: Q factor :type Q: int @@ -6914,16 +6920,16 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :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) + .. 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) 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) + 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) :param target: Target to save to :type target: Target @@ -6964,7 +6970,7 @@ Autogenerated methods :param page_height: Set page height for multipage save :type page_height: int :param profile: Filename of ICC profile to embed - :type profile: str + :type profile: str | Path :rtype: list[] :raises Error: diff --git a/examples/generate_type_stubs.py b/examples/generate_type_stubs.py index cac0d94..d864d4a 100755 --- a/examples/generate_type_stubs.py +++ b/examples/generate_type_stubs.py @@ -22,55 +22,25 @@ - Documentation generation (pyvips.Operation.generate_sphinx_all()) """ -import typing -from typing import Any, Optional, Union +import inspect +from pathlib import Path import pyvips -from pyvips import ( - GValue, - Introspect, - type_map, - type_from_name, - nickname_find, - at_least_libvips, -) +from pyvips import GValue, Introspect, type_map, type_from_name, nickname_find from pyvips import ffi, Error from pyvips.voperation import _OPERATION_DEPRECATED -def gtype_to_python_type(gtype: int) -> str: +def gtype_to_python_type(name: str, gtype: int, return_type: bool = False) -> str: """Map a gtype to Python type annotation string.""" - fundamental = pyvips.gobject_lib.g_type_fundamental(gtype) - - if fundamental == GValue.genum_type: - name = pyvips.type_name(gtype) - if name.startswith("Vips"): - name = name[4:] - return f"Union[str, {name}]" - - type_mapping = { - GValue.gbool_type: "bool", - GValue.gint_type: "int", - GValue.guint64_type: "int", - GValue.gdouble_type: "float", - GValue.gstr_type: "str", - GValue.refstr_type: "str", - GValue.gflags_type: "int", - GValue.gobject_type: "GObject", - GValue.image_type: "Image", - GValue.array_int_type: "list[int]", - GValue.array_double_type: "list[float]", - GValue.array_image_type: "list[Image]", - GValue.blob_type: "str", - GValue.source_type: "Source", - GValue.target_type: "Target", - } - - if gtype in type_mapping: - return type_mapping[gtype] - if fundamental in type_mapping: - return type_mapping[fundamental] - return "Any" + if ( + name in ("filename", "input_profile", "output_profile", "profile") + and gtype == GValue.gstr_type + ): + return "str | Path" + if not return_type and name in ("buffer",) and gtype == GValue.blob_type: + return "_BufferLike" + return GValue.gtype_to_python(gtype) PYTHON_KEYWORDS = { @@ -115,7 +85,7 @@ def escape_parameter_name(name: str) -> str: return name -def generate_method_signature(operation_name: str) -> str: +def generate_method_signature(operation_name: str) -> str | None: """Generate type signature for an operation method.""" intro = Introspect.get(operation_name) @@ -133,12 +103,16 @@ def generate_method_signature(operation_name: str) -> str: # Required args (excluding member_x for instance methods) for name in intro.method_args: - py_type = gtype_to_python_type(intro.details[name]["type"]) + py_type = gtype_to_python_type(name, intro.details[name]["type"]) args_list.append(f"{escape_parameter_name(name)}: {py_type}") # Optional args (excluding deprecated) + if intro.doc_optional_input: + args_list.append("*") for name in intro.doc_optional_input: - py_type = gtype_to_python_type(intro.details[name]["type"]) + py_type = gtype_to_python_type(name, intro.details[name]["type"]) + if name == "interpolate" and py_type == "GObject": + py_type = "Interpolate" args_list.append(f"{escape_parameter_name(name)}: {py_type} = ...") # Optional output args @@ -148,7 +122,7 @@ def generate_method_signature(operation_name: str) -> str: args_str = ", ".join(args_list) # Return type output_types = [ - gtype_to_python_type(intro.details[name]["type"]) + gtype_to_python_type(name, intro.details[name]["type"], return_type=True) for name in intro.required_output ] @@ -160,11 +134,10 @@ def generate_method_signature(operation_name: str) -> str: return_type = f"tuple[{', '.join(output_types)}]" # Optional output dicts can contain any metadata value type - if len(intro.doc_optional_output) > 0: - dict_value_type = ( - "Union[bool, int, float, str, Image, list[int], list[float], list[Image]]" + if len(intro.doc_optional_output) > 0 and return_type != "Image": + return_type = ( + f"{return_type} | tuple[{', '.join(output_types + ['_MetadataDict'])}]" ) - return_type = f"Union[{return_type}, tuple[{', '.join(output_types + [f'Dict[str, {dict_value_type}]'])}]]" if intro.member_x is not None: return f" def {operation_name}({args_str}) -> {return_type}: ..." @@ -210,100 +183,27 @@ def add_name(gtype, a, b): return "\n".join([sig for _, sig in all_names]) -def get_all_enum_names() -> list[str]: - """Get all enum type names from introspection.""" - - enum_names = set() - - def add_enums(gtype, a, b): - fundamental = pyvips.gobject_lib.g_type_fundamental(gtype) - if fundamental == GValue.genum_type: - name = pyvips.type_name(gtype) - if name.startswith("Vips"): - name = name[4:] - enum_names.add(name) - type_map(gtype, add_enums) - return ffi.NULL +def generate_enums() -> str: + """Generate the ``enums.py`` stub.""" + enum_names = sorted(n for n in dir(pyvips.enums) if not n.startswith("__")) + enum_dict = dict(inspect.getmembers(pyvips.enums)) + enum_defs: list[str] = [] + for e in enum_names: + et = enum_dict[e] + emems = [(m, mval) for m, mval in et.__dict__.items() if not m.startswith("__")] + enum_def = f"class {e}:\n" + "\n".join( + f" {name}: {type(value).__name__} = {value!r}" for name, value in emems + ) + enum_defs.append(enum_def) - type_map(type_from_name("VipsOperation"), add_enums) - - # Also add base enums - enum_names.update( - [ - "BandFormat", - "Interpretation", - "Kernel", - "Coding", - "Extend", - "Align", - "Direction", - "Angle", - "Angle45", - "Access", - "Shrink", - "Intent", - "PCS", - "OperationBoolean", - "OperationComplex", - "OperationComplex2", - "OperationComplexget", - "OperationMath", - "OperationMath2", - "OperationMorphology", - "OperationRelational", - "OperationRound", - "Interesting", - "SdfShape", - "TextWrap", - "Combine", - "CombineMode", - "CompassDirection", - "Precision", - "FailOn", - "BlendMode", - "ForeignDzLayout", - "ForeignDzDepth", - "ForeignDzContainer", - "RegionShrink", - "ForeignHeifCompression", - "ForeignSubsample", - "ForeignHeifEncoder", - "ForeignPpmFormat", - "ForeignTiffCompression", - "ForeignTiffPredictor", - "ForeignTiffResunit", - "ForeignWebpPreset", - "Size", - ] - ) - - return sorted(enum_names) - - -def generate_enum_class(name: str) -> str: - """Generate type stub for a single enum class.""" - if name == "Direction": - return """class Direction: - HORIZONTAL: str - VERTICAL: str -""" - elif name == "Align": - return """class Align: - LOW: str - CENTRE: str - HIGH: str -""" - else: - return f"class {name}: ..." + return "\n\n".join(enum_defs) def generate_stub() -> str: - """Generate complete pyvips type stub.""" - - # Get all enum names - enum_names = get_all_enum_names() + """Generate the ``init.py`` stub.""" - enum_classes = "\n".join([generate_enum_class(name) for name in enum_names]) + enum_names = sorted(n for n in dir(pyvips.enums) if not n.startswith("__")) + enums = ", ".join(f"{n} as {n}" for n in enum_names) stub = f'''"""Type stubs for pyvips. @@ -322,19 +222,52 @@ def generate_stub() -> str: python examples/generate_type_stubs.py """ -from __future__ import annotations -from typing import Dict, List, Optional, Tuple, TypeVar, Union, overload +from pathlib import Path +from types import TracebackType +from typing import Any, Callable, Protocol, TypeAlias + +import numpy as np # type: ignore[import-not-found] + +from .enums import {enums} + +class _ArrayInterface(Protocol): + @property + def __array_interface__(self) -> dict[str, Any]: ... + +class _Array(Protocol): + def __array__(self, dtype: np.dtype | None = None, copy: bool | None = None) -> Any: ... + +# Common type aliases +_NumberLike = int | float +_NumberLikeList = list[int] | list[float] +_NumberLike2DList = list[list[int]] | list[list[float]] + +# Required forward reference; remove and replace the following unions with `type` +# statements once Python 3.12 becomes the minimum supported version. +_ImageAlias: TypeAlias = "Image" + +_MetadataValue = bool | int | float | str | _ImageAlias | list[int] | list[float] | list[_ImageAlias] +_MetadataDict = dict[str, _MetadataValue] + +_BufferLike = bytes | bytearray | memoryview +_ImageOperand = _ImageAlias | _NumberLike | _NumberLikeList + +# Low-level handles and helpers +ffi: Any +glib_lib: Any +vips_lib: Any +gobject_lib: Any # Exception classes class Error(Exception): ... # GObject base classes -class GObject: - def signal_connect(self, name: str, callback: object) -> None: ... +class GObject(object): + def signal_connect(self, name: str, callback: Any) -> None: ... class VipsObject(GObject): ... -class GValue: +class GValue(object): gbool_type: int gint_type: int guint64_type: int @@ -353,27 +286,59 @@ class GValue: target_type: int format_type: int blend_mode_type: int - ... + + # mapping from GType to textual Python type description + _gtype_to_python: dict[int, str] + + # underlying C data + pointer: Any + gvalue: Any + + @staticmethod + def gtype_to_python(gtype: int) -> str: ... + @staticmethod + def to_enum(gtype: int, value: str | int) -> int: ... + @staticmethod + def from_enum(gtype: int, enum_value: int) -> str: ... + @staticmethod + def to_flag(gtype: int, value: str | int) -> int: ... + + def __init__(self) -> None: ... + + def set_type(self, gtype: int) -> None: ... + def set(self, value: _MetadataValue) -> None: ... + def get(self) -> _MetadataValue: ... # Connection classes -class Source: +class Connection(VipsObject): ... + +class Source(Connection): @staticmethod def new_from_descriptor(descriptor: int) -> Source: ... + class SourceCustom(Source): - def on_read(self, handler: object) -> None: ... - def on_seek(self, handler: object) -> None: ... -class Target: + def on_read(self, handler: Any) -> None: ... + def on_seek(self, handler: Any) -> None: ... + +class Target(Connection): @staticmethod def new_to_descriptor(descriptor: int) -> Target: ... -# Interpolator class -class Interpolate: @staticmethod - def new(name: str) -> Interpolate: ... + def new_to_memory() -> Target: ... -# Enum classes -{enum_classes} +class TargetCustom(Target): + def __init__(self) -> None: ... + def on_write(self, handler: Callable[[_BufferLike], int]) -> None: ... + def on_read(self, handler: Callable[[int], _BufferLike | None]) -> None: ... + def on_seek(self, handler: Callable[[int, int], int]) -> None: ... + def on_end(self, handler: Callable[..., int]) -> None: ... + def on_finish(self, handler: Callable[..., int]) -> None: ... +# Interpolator class +class Interpolate(VipsObject): + @staticmethod + def new(name: str) -> Interpolate: ... class Image(VipsObject): """Wrap a VipsImage object.""" @@ -386,9 +351,9 @@ def height(self) -> int: ... @property def bands(self) -> int: ... @property - def format(self) -> Union[str, BandFormat]: ... + def format(self) -> str | BandFormat: ... @property - def interpretation(self) -> Union[str, Interpretation]: ... + def interpretation(self) -> str | Interpretation: ... @property def xres(self) -> float: ... @property @@ -400,35 +365,36 @@ def yoffset(self) -> int: ... # Metadata methods # GValue can return: bool, int, float, str, Image, list[int], list[float], list[Image] + def get_gainmap(self) -> Image | None: ... def get_typeof(self, name: str) -> int: ... - def get(self, name: str) -> Union[bool, int, float, str, Image, list[int], list[float], list[Image]]: ... - def get_fields(self) -> List[str]: ... - def set_type(self, gtype: int, name: str, value: Union[bool, int, float, str, Image, list[int], list[float], list[Image]]) -> None: ... - def set(self, name: str, value: Union[bool, int, float, str, Image, list[int], list[float], list[Image]]) -> None: ... + def get(self, name: str) -> _MetadataValue: ... + def get_fields(self) -> list[str]: ... + def set_type(self, gtype: int, name: str, value: _MetadataValue) -> None: ... + def set(self, name: str, value: _MetadataValue) -> None: ... def remove(self, name: str) -> bool: ... # Constructors @staticmethod - def new_from_file(vips_filename: str, **kwargs: object) -> Image: ... + def new_from_file(vips_filename: str | Path, *, memory: bool = ..., access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... @staticmethod - def new_from_buffer(data: Union[bytes, bytearray, memoryview], options: str, **kwargs: object) -> Image: ... + def new_from_buffer(data: _BufferLike, options: str, *, access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... @staticmethod - def new_from_list(array: List[List[float]], scale: float =1.0, offset: float = 0.0) -> Image: ... + def new_from_list(array: _NumberLikeList | _NumberLike2DList, scale: float = 1.0, offset: float = 0.0) -> Image: ... @classmethod - def new_from_array(cls, obj: Union[List, bytes, bytearray, memoryview], scale: float = 1.0, offset: float = 0.0, interpretation: Optional[Union[str, Interpretation]] = None) -> Image: ... + def new_from_array(cls, obj: _NumberLikeList | _NumberLike2DList | _ArrayInterface | _Array, scale: float = 1.0, offset: float = 0.0, interpretation: str | Interpretation | None = None) -> Image: ... @staticmethod - def new_from_memory(data: Union[bytes, bytearray, memoryview], width: int, height: int, bands: int, format: Union[str, BandFormat]) -> Image: ... + def new_from_memory(data: _BufferLike, width: int, height: int, bands: int, format: str | BandFormat) -> Image: ... @staticmethod - def new_from_source(source: Source, options: str, **kwargs: object) -> Image: ... + def new_from_source(source: Source, options: str, **kwargs: Any) -> Image: ... @staticmethod def new_temp_file(format: str) -> Image: ... - def new_from_image(self, value: Union[float, int, List[float], List[int]]) -> Image: ... + def new_from_image(self, value: _NumberLike | _NumberLikeList) -> Image: ... def copy_memory(self) -> Image: ... # Writers - def write_to_file(self, vips_filename: str, **kwargs: object) -> None: ... - def write_to_buffer(self, format_string: str, **kwargs: object) -> bytes: ... - def write_to_target(self, target: Target, format_string: str, **kwargs: object) -> None: ... + def write_to_file(self, vips_filename: str | Path, **kwargs: Any) -> None: ... + def write_to_buffer(self, format_string: str, **kwargs: Any) -> bytes: ... + def write_to_target(self, target: Target, format_string: str, **kwargs: Any) -> None: ... def write_to_memory(self) -> bytes: ... def write(self, other: Image) -> None: ... @@ -436,79 +402,168 @@ def write(self, other: Image) -> None: ... def invalidate(self) -> None: ... def set_progress(self, progress: bool) -> None: ... def set_kill(self, kill: bool) -> None: ... - def copy(self, **kwargs: object) -> Image: ... - 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 copy(self, *, width: int = ..., height: int = ..., bands: int = ..., format: str | BandFormat = ..., coding: str | Coding = ..., interpretation: str | Interpretation = ..., xres: float = ..., yres: float = ..., xoffset: int = ..., yoffset: int = ...) -> Image: ... + def tolist(self) -> list[list[float]]: ... + def __array__(self, dtype: np.dtype | str | None = None, copy: bool | None = None) -> np.ndarray: ... + def numpy(self, dtype: np.dtype | str | None = None) -> np.ndarray: ... # Hand-written bindings with type hints def floor(self) -> Image: ... def ceil(self) -> Image: ... def rint(self) -> Image: ... - def bandsplit(self) -> List[Image]: ... - def bandjoin(self, other: Union[Image, float, int, List[Union[Image, float, int]]]) -> Image: ... - def bandrank(self, other: Union[Image, List[Image]], **kwargs: object) -> Image: ... - def composite(self, other: Union[Image, List[Image]], mode: Union[str, BlendMode, List[Union[str, BlendMode]]], **kwargs: object) -> Image: ... - def ifthenelse(self, in1: Union[Image, float, int], in2: Union[Image, float, int], **kwargs: object) -> Image: ... - def hasalpha(self) -> bool: ... + def bandand(self) -> Image: ... + def bandor(self) -> Image: ... + def bandeor(self) -> Image: ... + def bandsplit(self) -> list[Image]: ... + def bandjoin(self, other: Image | _NumberLike | _NumberLikeList | list[Image | _NumberLike]) -> Image: ... + def atan2(self, other: _ImageOperand) -> Image: ... def get_n_pages(self) -> int: ... def get_page_height(self) -> int: ... - def pagesplit(self) -> List[Image]: ... - def pagejoin(self, other: Union[Image, List[Image]]) -> Image: ... - def scaleimage(self, **kwargs: object) -> Image: ... - def erode(self, mask: Union[Image, List[List[int]]]) -> Image: ... - def dilate(self, mask: Union[Image, List[List[int]]]) -> Image: ... + def pagesplit(self) -> list[Image]: ... + def pagejoin(self, other: Image | list[Image]) -> Image: ... + def composite(self, other: Image | list[Image], mode: str | BlendMode | list[str | BlendMode], *, compositing_space: Interpretation = ..., premultiplied: bool = ..., x: list[int] | int = ..., y: list[int] | int = ...) -> Image: ... + def bandrank(self, other: Image | list[Image], *, index: int = ...) -> Image: ... + def maxpos(self) -> tuple[float, int, int]: ... + def minpos(self) -> tuple[float, int, int]: ... + def real(self) -> Image: ... + def imag(self) -> Image: ... + def polar(self) -> Image: ... + def rect(self) -> Image: ... + def conj(self) -> Image: ... + def sin(self) -> Image: ... + def cos(self) -> Image: ... + def tan(self) -> Image: ... + def asin(self) -> Image: ... + def acos(self) -> Image: ... + def atan(self) -> Image: ... + def sinh(self) -> Image: ... + def cosh(self) -> Image: ... + def tanh(self) -> Image: ... + def asinh(self) -> Image: ... + def acosh(self) -> Image: ... + def atanh(self) -> Image: ... + def log(self) -> Image: ... + def log10(self) -> Image: ... + def exp(self) -> Image: ... + def exp10(self) -> Image: ... + def erode(self, mask: Image | list[list[int]]) -> Image: ... + def dilate(self, mask: Image | list[list[int]]) -> Image: ... + def median(self, size: int) -> Image: ... + def fliphor(self) -> Image: ... + def flipver(self) -> Image: ... + def rot90(self) -> Image: ... + def rot180(self) -> Image: ... + def rot270(self) -> Image: ... + def hasalpha(self) -> bool: ... + def ifthenelse(self, in1: Image | _NumberLike | _NumberLikeList | _NumberLike2DList, in2: Image | _NumberLike | _NumberLikeList | _NumberLike2DList, *, blend: bool = ...) -> Image: ... + def scaleimage(self, *, log: bool = ..., exp: float = ...) -> Image: ... # Dynamically generated operations -''' +{generate_all_image_operations()} - stub += generate_all_image_operations() - - stub += """ - - # Operator overloads - def __add__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __radd__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __sub__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rsub__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __mul__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rmul__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __truediv__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rtruediv__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __floordiv__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rfloordiv__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __mod__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __pow__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rpow__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... + # Operators + def __repr__(self) -> str: ... + def __getattr__(self, name: str) -> Any: ... + def __enter__(self) -> Image: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... + def __getitem__(self, arg: int | slice | list[int] | list[bool]) -> Image: ... + def __call__(self, x: int, y: int) -> list[float]: ... + # Arithmetic operators + def __add__(self, other: _ImageOperand) -> Image: ... + def __radd__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __sub__(self, other: _ImageOperand) -> Image: ... + def __rsub__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __mul__(self, other: _ImageOperand) -> Image: ... + def __rmul__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __div__(self, other: _ImageOperand) -> Image: ... + def __rdiv__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __truediv__(self, other: _ImageOperand) -> Image: ... + def __rtruediv__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __floordiv__(self, other: _ImageOperand) -> Image: ... + def __rfloordiv__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __mod__(self, other: _ImageOperand) -> Image: ... + def __pow__(self, other: _ImageOperand) -> Image: ... + def __rpow__(self, other: _ImageOperand) -> Image: ... def __abs__(self) -> Image: ... + def __lshift__(self, other: _ImageOperand) -> Image: ... + def __rshift__(self, other: _ImageOperand) -> Image: ... + def __and__(self, other: _ImageOperand) -> Image: ... + def __rand__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __or__(self, other: _ImageOperand) -> Image: ... + def __ror__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __xor__(self, other: _ImageOperand) -> Image: ... + def __rxor__(self, other: _NumberLike | _NumberLikeList) -> Image: ... def __neg__(self) -> Image: ... def __pos__(self) -> Image: ... def __invert__(self) -> Image: ... - def __lshift__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rshift__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __and__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rand__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __or__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __ror__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __xor__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rxor__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __gt__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __ge__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __lt__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __le__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - - def __getitem__(self, arg: Union[int, slice, List[int], List[bool]]) -> Image: ... - def __call__(self, x: int, y: int) -> List[float]: ... - def __repr__(self) -> str: ... + # Comparison operators + def __gt__(self, other: _ImageOperand) -> Image: ... + def __ge__(self, other: _ImageOperand) -> Image: ... + def __lt__(self, other: _ImageOperand) -> Image: ... + def __le__(self, other: _ImageOperand) -> Image: ... + def __eq__(self, other: Any) -> bool | Image: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def __ne__(self, other: Any) -> bool | Image: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + + # Compatibility (deprecated) methods + def get_value(self, name: str) -> _MetadataValue: ... + def set_value(self, name: str, value: _MetadataValue) -> None: ... + def get_scale(self) -> float: ... + def get_offset(self) -> float: ... + +class Operation(VipsObject): + @staticmethod + def new_from_name(operation_name: str) -> "Operation": ... + def set(self, name: str, flags: int, match_image: Image | None, value: Any) -> None: ... + @staticmethod + def call(operation_name: str, *args: Any, **kwargs: Any) -> Any: ... + @staticmethod + def generate_docstring(operation_name: str) -> str: ... + @staticmethod + def generate_sphinx(operation_name: str) -> str: ... + @staticmethod + def generate_sphinx_all() -> None: ... +class Introspect(object): + description: str + flags: int + details: dict[str, dict[str, Any]] -class Operation: ... -class Introspect: ... + required_input: list[str] + optional_input: list[str] + required_output: list[str] + optional_output: list[str] + + doc_optional_input: list[str] + doc_optional_output: list[str] + + member_x: str | None + method_args: list[str] + + def __init__(self, operation_name: str) -> None: ... + @classmethod + def get(cls: type["Introspect"], operation_name: str) -> "Introspect": ... # Global functions + +# base.py +def _to_string(cdata: Any) -> str: ... +def _to_bytes(value: object) -> bytes: ... +def leak_set(leak: bool) -> None: ... +def shutdown() -> None: ... +def version(flag: int) -> int: ... +def get_suffixes() -> list[str]: ... +def at_least_libvips(x: int, y: int) -> bool: ... +def type_find(basename: str, nickname: str) -> int: ... +def type_name(gtype: int) -> str: ... +def nickname_find(gtype: int) -> str: ... +def type_from_name(name: str) -> int: ... +def type_map(gtype: int, fn: Callable[..., int]) -> int: ... +def values_for_enum(gtype: int) -> list[str]: ... +def values_for_flag(gtype: int) -> list[str]: ... +def enum_dict(gtype: int) -> dict[str, int]: ... +def flags_dict(gtype: int) -> dict[str, int]: ... + +# voperation.py def cache_set_max(mx: int) -> None: ... def cache_set_max_mem(mx: int) -> None: ... def cache_set_max_files(mx: int) -> None: ... @@ -519,27 +574,25 @@ def cache_get_max_mem() -> int: ... def cache_get_max_files() -> int: ... def block_untrusted_set(state: bool) -> None: ... def operation_block_set(name: str, state: bool) -> None: ... -def leak_set(leak: bool) -> None: ... -def shutdown() -> None: ... -def call(operation_name: str, *args: object, **kwargs: object) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + +def call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, _MetadataDict]: ... # Module-level constants API_mode: bool -""" +''' return stub if __name__ == "__main__": - # Generate stub - stub_content = generate_stub() + stub_base = Path(__file__).parents[1] / "pyvips" # Write to pyvips/__init__.pyi - import os - - # Script is in examples/, need to go up one level to find pyvips/ - stub_file = os.path.join(os.path.dirname(__file__), "..", "pyvips", "__init__.pyi") - with open(stub_file, "w") as f: - f.write(stub_content) + stub_file = stub_base / "__init__.pyi" + stub_file.write_text(generate_stub()) + print(f"Generated type stub at {stub_file}") + # Write to pyvips/enums.pyi + stub_file = stub_base / "enums.pyi" + stub_file.write_text(generate_enums()) print(f"Generated type stub at {stub_file}") diff --git a/examples/orientation.py b/examples/orientation.py index d552a45..f89ed0e 100755 --- a/examples/orientation.py +++ b/examples/orientation.py @@ -7,6 +7,7 @@ try: orientation = a.get('exif-ifd0-Orientation') + assert isinstance(orientation, str) a.set('orientation', int(orientation.split()[0])) except Exception: a.set('orientation', 0) diff --git a/examples/shepard.py b/examples/shepard.py index 4ec8958..5e53561 100755 --- a/examples/shepard.py +++ b/examples/shepard.py @@ -25,8 +25,8 @@ def shepards(image: pyvips.Image, couples: List[Couple]) -> pyvips.Image: """ index = pyvips.Image.xyz(image.width, image.height) - deltas = [] - weights = [] + deltas: list[pyvips.Image] = [] + weights: list[pyvips.Image] = [] for p1, p2 in couples: diff = index - list(p2) @@ -35,7 +35,7 @@ def shepards(image: pyvips.Image, couples: List[Couple]) -> pyvips.Image: weight = 1.0 / distance - delta = [(p1[0] - p2[0]), (p1[1] - p2[1])] * weight + delta = weight * [(p1[0] - p2[0]), (p1[1] - p2[1])] weights.append(weight) deltas.append(delta) diff --git a/pyvips/__init__.pyi b/pyvips/__init__.pyi index bc30b92..f831bdf 100644 --- a/pyvips/__init__.pyi +++ b/pyvips/__init__.pyi @@ -15,19 +15,52 @@ To regenerate after libvips updates: python examples/generate_type_stubs.py """ -from __future__ import annotations -from typing import Dict, List, Optional, Tuple, TypeVar, Union, overload +from pathlib import Path +from types import TracebackType +from typing import Any, Callable, Protocol, TypeAlias + +import numpy as np # type: ignore[import-not-found] + +from .enums import Access as Access, Align as Align, Angle as Angle, Angle45 as Angle45, BandFormat as BandFormat, BlendMode as BlendMode, Coding as Coding, Combine as Combine, CombineMode as CombineMode, CompassDirection as CompassDirection, Direction as Direction, Extend as Extend, FailOn as FailOn, ForeignDzContainer as ForeignDzContainer, ForeignDzDepth as ForeignDzDepth, ForeignDzLayout as ForeignDzLayout, ForeignHeifCompression as ForeignHeifCompression, ForeignHeifEncoder as ForeignHeifEncoder, ForeignKeep as ForeignKeep, ForeignPdfPageBox as ForeignPdfPageBox, ForeignPngFilter as ForeignPngFilter, ForeignPpmFormat as ForeignPpmFormat, ForeignSubsample as ForeignSubsample, ForeignTiffCompression as ForeignTiffCompression, ForeignTiffPredictor as ForeignTiffPredictor, ForeignTiffResunit as ForeignTiffResunit, ForeignWebpPreset as ForeignWebpPreset, Intent as Intent, Interesting as Interesting, Interpretation as Interpretation, Kernel as Kernel, OperationBoolean as OperationBoolean, OperationComplex as OperationComplex, OperationComplex2 as OperationComplex2, OperationComplexget as OperationComplexget, OperationMath as OperationMath, OperationMath2 as OperationMath2, OperationMorphology as OperationMorphology, OperationRelational as OperationRelational, OperationRound as OperationRound, PCS as PCS, Precision as Precision, RegionShrink as RegionShrink, SdfShape as SdfShape, Size as Size, TextWrap as TextWrap + +class _ArrayInterface(Protocol): + @property + def __array_interface__(self) -> dict[str, Any]: ... + +class _Array(Protocol): + def __array__(self, dtype: np.dtype | None = None, copy: bool | None = None) -> Any: ... + +# Common type aliases +_NumberLike = int | float +_NumberLikeList = list[int] | list[float] +_NumberLike2DList = list[list[int]] | list[list[float]] + +# Required forward reference; remove and replace the following unions with `type` +# statements once Python 3.12 becomes the minimum supported version. +_ImageAlias: TypeAlias = "Image" + +_MetadataValue = bool | int | float | str | _ImageAlias | list[int] | list[float] | list[_ImageAlias] +_MetadataDict = dict[str, _MetadataValue] + +_BufferLike = bytes | bytearray | memoryview +_ImageOperand = _ImageAlias | _NumberLike | _NumberLikeList + +# Low-level handles and helpers +ffi: Any +glib_lib: Any +vips_lib: Any +gobject_lib: Any # Exception classes class Error(Exception): ... # GObject base classes -class GObject: - def signal_connect(self, name: str, callback: object) -> None: ... +class GObject(object): + def signal_connect(self, name: str, callback: Any) -> None: ... class VipsObject(GObject): ... -class GValue: +class GValue(object): gbool_type: int gint_type: int guint64_type: int @@ -46,77 +79,59 @@ class GValue: target_type: int format_type: int blend_mode_type: int - ... + + # mapping from GType to textual Python type description + _gtype_to_python: dict[int, str] + + # underlying C data + pointer: Any + gvalue: Any + + @staticmethod + def gtype_to_python(gtype: int) -> str: ... + @staticmethod + def to_enum(gtype: int, value: str | int) -> int: ... + @staticmethod + def from_enum(gtype: int, enum_value: int) -> str: ... + @staticmethod + def to_flag(gtype: int, value: str | int) -> int: ... + + def __init__(self) -> None: ... + + def set_type(self, gtype: int) -> None: ... + def set(self, value: _MetadataValue) -> None: ... + def get(self) -> _MetadataValue: ... # Connection classes -class Source: +class Connection(VipsObject): ... + +class Source(Connection): @staticmethod def new_from_descriptor(descriptor: int) -> Source: ... + class SourceCustom(Source): - def on_read(self, handler: object) -> None: ... - def on_seek(self, handler: object) -> None: ... -class Target: + def on_read(self, handler: Any) -> None: ... + def on_seek(self, handler: Any) -> None: ... + +class Target(Connection): @staticmethod def new_to_descriptor(descriptor: int) -> Target: ... -# Interpolator class -class Interpolate: @staticmethod - def new(name: str) -> Interpolate: ... + def new_to_memory() -> Target: ... -# Enum classes -class Access: ... -class Align: - LOW: str - CENTRE: str - HIGH: str - -class Angle: ... -class Angle45: ... -class BandFormat: ... -class BlendMode: ... -class Coding: ... -class Combine: ... -class CombineMode: ... -class CompassDirection: ... -class Direction: - HORIZONTAL: str - VERTICAL: str - -class Extend: ... -class FailOn: ... -class ForeignDzContainer: ... -class ForeignDzDepth: ... -class ForeignDzLayout: ... -class ForeignHeifCompression: ... -class ForeignHeifEncoder: ... -class ForeignPpmFormat: ... -class ForeignSubsample: ... -class ForeignTiffCompression: ... -class ForeignTiffPredictor: ... -class ForeignTiffResunit: ... -class ForeignWebpPreset: ... -class Intent: ... -class Interesting: ... -class Interpretation: ... -class Kernel: ... -class OperationBoolean: ... -class OperationComplex: ... -class OperationComplex2: ... -class OperationComplexget: ... -class OperationMath: ... -class OperationMath2: ... -class OperationMorphology: ... -class OperationRelational: ... -class OperationRound: ... -class PCS: ... -class Precision: ... -class RegionShrink: ... -class SdfShape: ... -class Shrink: ... -class Size: ... -class TextWrap: ... +class TargetCustom(Target): + def __init__(self) -> None: ... + def on_write(self, handler: Callable[[_BufferLike], int]) -> None: ... + def on_read(self, handler: Callable[[int], _BufferLike | None]) -> None: ... + def on_seek(self, handler: Callable[[int, int], int]) -> None: ... + def on_end(self, handler: Callable[..., int]) -> None: ... + def on_finish(self, handler: Callable[..., int]) -> None: ... +# Interpolator class +class Interpolate(VipsObject): + @staticmethod + def new(name: str) -> Interpolate: ... class Image(VipsObject): """Wrap a VipsImage object.""" @@ -129,9 +144,9 @@ class Image(VipsObject): @property def bands(self) -> int: ... @property - def format(self) -> Union[str, BandFormat]: ... + def format(self) -> str | BandFormat: ... @property - def interpretation(self) -> Union[str, Interpretation]: ... + def interpretation(self) -> str | Interpretation: ... @property def xres(self) -> float: ... @property @@ -143,35 +158,36 @@ class Image(VipsObject): # Metadata methods # GValue can return: bool, int, float, str, Image, list[int], list[float], list[Image] + def get_gainmap(self) -> Image | None: ... def get_typeof(self, name: str) -> int: ... - def get(self, name: str) -> Union[bool, int, float, str, Image, list[int], list[float], list[Image]]: ... - def get_fields(self) -> List[str]: ... - def set_type(self, gtype: int, name: str, value: Union[bool, int, float, str, Image, list[int], list[float], list[Image]]) -> None: ... - def set(self, name: str, value: Union[bool, int, float, str, Image, list[int], list[float], list[Image]]) -> None: ... + def get(self, name: str) -> _MetadataValue: ... + def get_fields(self) -> list[str]: ... + def set_type(self, gtype: int, name: str, value: _MetadataValue) -> None: ... + def set(self, name: str, value: _MetadataValue) -> None: ... def remove(self, name: str) -> bool: ... # Constructors @staticmethod - def new_from_file(vips_filename: str, **kwargs: object) -> Image: ... + def new_from_file(vips_filename: str | Path, *, memory: bool = ..., access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... @staticmethod - def new_from_buffer(data: Union[bytes, bytearray, memoryview], options: str, **kwargs: object) -> Image: ... + def new_from_buffer(data: _BufferLike, options: str, *, access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... @staticmethod - def new_from_list(array: List[List[float]], scale: float =1.0, offset: float = 0.0) -> Image: ... + def new_from_list(array: _NumberLikeList | _NumberLike2DList, scale: float = 1.0, offset: float = 0.0) -> Image: ... @classmethod - def new_from_array(cls, obj: Union[List, bytes, bytearray, memoryview], scale: float = 1.0, offset: float = 0.0, interpretation: Optional[Union[str, Interpretation]] = None) -> Image: ... + def new_from_array(cls, obj: _NumberLikeList | _NumberLike2DList | _ArrayInterface | _Array, scale: float = 1.0, offset: float = 0.0, interpretation: str | Interpretation | None = None) -> Image: ... @staticmethod - def new_from_memory(data: Union[bytes, bytearray, memoryview], width: int, height: int, bands: int, format: Union[str, BandFormat]) -> Image: ... + def new_from_memory(data: _BufferLike, width: int, height: int, bands: int, format: str | BandFormat) -> Image: ... @staticmethod - def new_from_source(source: Source, options: str, **kwargs: object) -> Image: ... + def new_from_source(source: Source, options: str, **kwargs: Any) -> Image: ... @staticmethod def new_temp_file(format: str) -> Image: ... - def new_from_image(self, value: Union[float, int, List[float], List[int]]) -> Image: ... + def new_from_image(self, value: _NumberLike | _NumberLikeList) -> Image: ... def copy_memory(self) -> Image: ... # Writers - def write_to_file(self, vips_filename: str, **kwargs: object) -> None: ... - def write_to_buffer(self, format_string: str, **kwargs: object) -> bytes: ... - def write_to_target(self, target: Target, format_string: str, **kwargs: object) -> None: ... + def write_to_file(self, vips_filename: str | Path, **kwargs: Any) -> None: ... + def write_to_buffer(self, format_string: str, **kwargs: Any) -> bytes: ... + def write_to_target(self, target: Target, format_string: str, **kwargs: Any) -> None: ... def write_to_memory(self) -> bytes: ... def write(self, other: Image) -> None: ... @@ -179,29 +195,61 @@ class Image(VipsObject): def invalidate(self) -> None: ... def set_progress(self, progress: bool) -> None: ... def set_kill(self, kill: bool) -> None: ... - def copy(self, **kwargs: object) -> Image: ... - 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 copy(self, *, width: int = ..., height: int = ..., bands: int = ..., format: str | BandFormat = ..., coding: str | Coding = ..., interpretation: str | Interpretation = ..., xres: float = ..., yres: float = ..., xoffset: int = ..., yoffset: int = ...) -> Image: ... + def tolist(self) -> list[list[float]]: ... + def __array__(self, dtype: np.dtype | str | None = None, copy: bool | None = None) -> np.ndarray: ... + def numpy(self, dtype: np.dtype | str | None = None) -> np.ndarray: ... # Hand-written bindings with type hints def floor(self) -> Image: ... def ceil(self) -> Image: ... def rint(self) -> Image: ... - def bandsplit(self) -> List[Image]: ... - def bandjoin(self, other: Union[Image, float, int, List[Union[Image, float, int]]]) -> Image: ... - def bandrank(self, other: Union[Image, List[Image]], **kwargs: object) -> Image: ... - def composite(self, other: Union[Image, List[Image]], mode: Union[str, BlendMode, List[Union[str, BlendMode]]], **kwargs: object) -> Image: ... - def ifthenelse(self, in1: Union[Image, float, int], in2: Union[Image, float, int], **kwargs: object) -> Image: ... - def hasalpha(self) -> bool: ... + def bandand(self) -> Image: ... + def bandor(self) -> Image: ... + def bandeor(self) -> Image: ... + def bandsplit(self) -> list[Image]: ... + def bandjoin(self, other: Image | _NumberLike | _NumberLikeList | list[Image | _NumberLike]) -> Image: ... + def atan2(self, other: _ImageOperand) -> Image: ... def get_n_pages(self) -> int: ... def get_page_height(self) -> int: ... - def pagesplit(self) -> List[Image]: ... - def pagejoin(self, other: Union[Image, List[Image]]) -> Image: ... - def scaleimage(self, **kwargs: object) -> Image: ... - def erode(self, mask: Union[Image, List[List[int]]]) -> Image: ... - def dilate(self, mask: Union[Image, List[List[int]]]) -> Image: ... + def pagesplit(self) -> list[Image]: ... + def pagejoin(self, other: Image | list[Image]) -> Image: ... + def composite(self, other: Image | list[Image], mode: str | BlendMode | list[str | BlendMode], *, compositing_space: Interpretation = ..., premultiplied: bool = ..., x: list[int] | int = ..., y: list[int] | int = ...) -> Image: ... + def bandrank(self, other: Image | list[Image], *, index: int = ...) -> Image: ... + def maxpos(self) -> tuple[float, int, int]: ... + def minpos(self) -> tuple[float, int, int]: ... + def real(self) -> Image: ... + def imag(self) -> Image: ... + def polar(self) -> Image: ... + def rect(self) -> Image: ... + def conj(self) -> Image: ... + def sin(self) -> Image: ... + def cos(self) -> Image: ... + def tan(self) -> Image: ... + def asin(self) -> Image: ... + def acos(self) -> Image: ... + def atan(self) -> Image: ... + def sinh(self) -> Image: ... + def cosh(self) -> Image: ... + def tanh(self) -> Image: ... + def asinh(self) -> Image: ... + def acosh(self) -> Image: ... + def atanh(self) -> Image: ... + def log(self) -> Image: ... + def log10(self) -> Image: ... + def exp(self) -> Image: ... + def exp10(self) -> Image: ... + def erode(self, mask: Image | list[list[int]]) -> Image: ... + def dilate(self, mask: Image | list[list[int]]) -> Image: ... + def median(self, size: int) -> Image: ... + def fliphor(self) -> Image: ... + def flipver(self) -> Image: ... + def rot90(self) -> Image: ... + def rot180(self) -> Image: ... + def rot270(self) -> Image: ... + def hasalpha(self) -> bool: ... + def ifthenelse(self, in1: Image | _NumberLike | _NumberLikeList | _NumberLike2DList, in2: Image | _NumberLike | _NumberLikeList | _NumberLike2DList, *, blend: bool = ...) -> Image: ... + def scaleimage(self, *, log: bool = ..., exp: float = ...) -> Image: ... # Dynamically generated operations def CMC2LCh(self) -> Image: ... @@ -212,433 +260,520 @@ class Image(VipsObject): def Lab2LCh(self) -> Image: ... def Lab2LabQ(self) -> Image: ... def Lab2LabS(self) -> Image: ... - def Lab2XYZ(self, temp: list[float] = ...) -> Image: ... + def Lab2XYZ(self, *, temp: list[float] = ...) -> Image: ... def LabQ2Lab(self) -> Image: ... def LabQ2LabS(self) -> Image: ... def LabQ2sRGB(self) -> Image: ... def LabS2Lab(self) -> Image: ... def LabS2LabQ(self) -> Image: ... + def Oklab2Oklch(self) -> Image: ... + def Oklab2XYZ(self) -> Image: ... + def Oklch2Oklab(self) -> Image: ... def XYZ2CMYK(self) -> Image: ... - def XYZ2Lab(self, temp: list[float] = ...) -> Image: ... + def XYZ2Lab(self, *, temp: list[float] = ...) -> Image: ... + def XYZ2Oklab(self) -> Image: ... def XYZ2Yxy(self) -> Image: ... def XYZ2scRGB(self) -> Image: ... def Yxy2XYZ(self) -> Image: ... def abs(self) -> Image: ... def add(self, right: Image) -> Image: ... def addalpha(self) -> Image: ... - def affine(self, matrix: list[float], interpolate: GObject = ..., oarea: list[int] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ..., background: list[float] = ..., premultiplied: bool = ..., extend: Union[str, Extend] = ...) -> Image: ... + def affine(self, matrix: list[float], *, interpolate: Interpolate = ..., oarea: list[int] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ..., background: list[float] = ..., premultiplied: bool = ..., extend: str | Extend = ...) -> Image: ... @staticmethod - def analyzeload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def analyzeload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def arrayjoin(in_: list[Image], across: int = ..., shim: int = ..., background: list[float] = ..., halign: Union[str, Align] = ..., valign: Union[str, Align] = ..., hspacing: int = ..., vspacing: int = ...) -> Image: ... - def autorot(self, angle: bool = ..., flip: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def arrayjoin(in_: list[Image], *, across: int = ..., shim: int = ..., background: list[float] = ..., halign: str | Align = ..., valign: str | Align = ..., hspacing: int = ..., vspacing: int = ...) -> Image: ... + def autorot(self, angle: bool = ..., flip: bool = ...) -> Image: ... def avg(self) -> float: ... - def bandbool(self, boolean: Union[str, OperationBoolean]) -> Image: ... - def bandfold(self, factor: int = ...) -> Image: ... + def bandbool(self, boolean: str | OperationBoolean) -> Image: ... + def bandfold(self, *, factor: int = ...) -> Image: ... def bandjoin_const(self, c: list[float]) -> Image: ... def bandmean(self) -> Image: ... - def bandunfold(self, factor: int = ...) -> Image: ... + def bandunfold(self, *, factor: int = ...) -> Image: ... @staticmethod - def black(width: int, height: int, bands: int = ...) -> Image: ... - def boolean(self, right: Image, boolean: Union[str, OperationBoolean]) -> Image: ... - def boolean_const(self, boolean: Union[str, OperationBoolean], c: list[float]) -> Image: ... + def black(width: int, height: int, *, bands: int = ...) -> Image: ... + def boolean(self, right: Image, boolean: str | OperationBoolean) -> Image: ... + def boolean_const(self, boolean: str | OperationBoolean, c: list[float]) -> Image: ... def buildlut(self) -> Image: ... def byteswap(self) -> Image: ... - def canny(self, sigma: float = ..., precision: Union[str, Precision] = ...) -> Image: ... + def canny(self, *, sigma: float = ..., precision: str | Precision = ...) -> Image: ... def case(self, cases: list[Image]) -> Image: ... - def cast(self, format: Union[str, BandFormat], shift: bool = ...) -> Image: ... - def clamp(self, min_: float = ..., max_: float = ...) -> Image: ... - def colourspace(self, space: Union[str, Interpretation], source_space: Union[str, Interpretation] = ...) -> Image: ... - def compass(self, mask: Image, times: int = ..., angle: Union[str, Angle45] = ..., combine: Union[str, Combine] = ..., precision: Union[str, Precision] = ..., layers: int = ..., cluster: int = ...) -> Image: ... - def complex(self, cmplx: Union[str, OperationComplex]) -> Image: ... - def complex2(self, right: Image, cmplx: Union[str, OperationComplex2]) -> Image: ... + def cast(self, format: str | BandFormat, *, shift: bool = ...) -> Image: ... + def clamp(self, *, min_: float = ..., max_: float = ...) -> Image: ... + def colourspace(self, space: str | Interpretation, *, source_space: str | Interpretation = ...) -> Image: ... + def compass(self, mask: Image, *, times: int = ..., angle: str | Angle45 = ..., combine: str | Combine = ..., precision: str | Precision = ..., layers: int = ..., cluster: int = ...) -> Image: ... + def complex(self, cmplx: str | OperationComplex) -> Image: ... + def complex2(self, right: Image, cmplx: str | OperationComplex2) -> Image: ... def complexform(self, right: Image) -> Image: ... - def complexget(self, get: Union[str, OperationComplexget]) -> Image: ... - def composite2(self, overlay: Image, mode: Union[str, BlendMode], x: int = ..., y: int = ..., compositing_space: Union[str, Interpretation] = ..., premultiplied: bool = ...) -> Image: ... - def conv(self, mask: Image, precision: Union[str, Precision] = ..., layers: int = ..., cluster: int = ...) -> Image: ... - def conva(self, mask: Image, layers: int = ..., cluster: int = ...) -> Image: ... - def convasep(self, mask: Image, layers: int = ...) -> Image: ... + def complexget(self, get: str | OperationComplexget) -> Image: ... + def composite2(self, overlay: Image, mode: str | BlendMode, *, x: int = ..., y: int = ..., compositing_space: str | Interpretation = ..., premultiplied: bool = ...) -> Image: ... + def conv(self, mask: Image, *, precision: str | Precision = ..., layers: int = ..., cluster: int = ...) -> Image: ... + def conva(self, mask: Image, *, layers: int = ..., cluster: int = ...) -> Image: ... + def convasep(self, mask: Image, *, layers: int = ...) -> Image: ... def convf(self, mask: Image) -> Image: ... def convi(self, mask: Image) -> Image: ... - def convsep(self, mask: Image, precision: Union[str, Precision] = ..., layers: int = ..., cluster: int = ...) -> Image: ... - def countlines(self, direction: Union[str, Direction]) -> float: ... + def convsep(self, mask: Image, *, precision: str | Precision = ..., layers: int = ..., cluster: int = ...) -> Image: ... + def countlines(self, direction: str | Direction) -> float: ... def crop(self, left: int, top: int, width: int, height: int) -> Image: ... @staticmethod - def csvload(filename: str, skip: int = ..., lines: int = ..., whitespace: str = ..., separator: str = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def csvload(filename: str | Path, *, skip: int = ..., lines: int = ..., whitespace: str = ..., separator: str = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def csvload_source(source: Source, skip: int = ..., lines: int = ..., whitespace: str = ..., separator: str = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def csvsave(self, filename: str, separator: str = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def csvsave_target(self, target: Target, separator: str = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... + def csvload_source(source: Source, *, skip: int = ..., lines: int = ..., whitespace: str = ..., separator: str = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def csvsave(self, filename: str | Path, *, separator: str = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def csvsave_target(self, target: Target, *, separator: str = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... def dE00(self, right: Image) -> Image: ... def dE76(self, right: Image) -> Image: ... def dECMC(self, right: Image) -> Image: ... + @staticmethod + 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 = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + 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: ... - def draw_flood(self, ink: list[float], x: int, y: int, test: Image = ..., equal: bool = ..., left: bool = ..., top: bool = ..., width: bool = ..., height: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def draw_image(self, sub: Image, x: int, y: int, mode: Union[str, CombineMode] = ...) -> Image: ... + def draw_circle(self, ink: list[float], cx: int, cy: int, radius: int, *, fill: bool = ...) -> Image: ... + def draw_flood(self, ink: list[float], x: int, y: int, *, test: Image = ..., equal: bool = ..., left: bool = ..., top: bool = ..., width: bool = ..., height: bool = ...) -> Image: ... + def draw_image(self, sub: Image, x: int, y: int, *, mode: str | CombineMode = ...) -> Image: ... def draw_line(self, ink: list[float], x1: int, y1: int, x2: int, y2: int) -> Image: ... def draw_mask(self, ink: list[float], mask: Image, x: int, y: int) -> Image: ... - def draw_rect(self, ink: list[float], left: int, top: int, width: int, height: int, fill: bool = ...) -> Image: ... + def draw_rect(self, ink: list[float], left: int, top: int, width: int, height: int, *, fill: bool = ...) -> Image: ... def draw_smudge(self, left: int, top: int, width: int, height: int) -> Image: ... - def dzsave(self, filename: str, 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 = ...) -> None: ... - def dzsave_buffer(self, 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 = ...) -> str: ... - def dzsave_target(self, 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 = ...) -> None: ... - def embed(self, x: int, y: int, width: int, height: int, extend: Union[str, Extend] = ..., background: list[float] = ...) -> Image: ... + def dzsave(self, filename: str | Path, *, 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 = ...) -> None: ... + def dzsave_buffer(self, *, 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 = ...) -> bytes: ... + def dzsave_target(self, 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 = ...) -> None: ... + def embed(self, x: int, y: int, width: int, height: int, *, extend: str | Extend = ..., background: list[float] = ...) -> Image: ... def extract_area(self, left: int, top: int, width: int, height: int) -> Image: ... - def extract_band(self, band: int, n: int = ...) -> Image: ... + def extract_band(self, band: int, *, n: int = ...) -> Image: ... @staticmethod - def eye(width: int, height: int, uchar: bool = ..., factor: float = ...) -> Image: ... + def eye(width: int, height: int, *, uchar: bool = ..., factor: float = ...) -> Image: ... def falsecolour(self) -> Image: ... def fastcor(self, ref: Image) -> Image: ... - def fill_nearest(self, distance: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def find_trim(self, threshold: float = ..., background: list[float] = ..., line_art: bool = ...) -> tuple[int, int, int, int]: ... + def fill_nearest(self, distance: bool = ...) -> Image: ... + def find_trim(self, *, threshold: float = ..., background: list[float] = ..., line_art: bool = ...) -> tuple[int, int, int, int]: ... @staticmethod - def fitsload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def fitsload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def fitsload_source(source: Source, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def fitssave(self, filename: str, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def flatten(self, background: list[float] = ..., max_alpha: float = ...) -> Image: ... - def flip(self, direction: Union[str, Direction]) -> Image: ... + def fitsload_source(source: Source, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def fitssave(self, filename: str | Path, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def flatten(self, *, background: list[float] = ..., max_alpha: float = ...) -> Image: ... + def flip(self, direction: str | Direction) -> Image: ... def float2rad(self) -> Image: ... @staticmethod def fractsurf(width: int, height: int, fractal_dimension: float) -> Image: ... def freqmult(self, mask: Image) -> Image: ... def fwfft(self) -> Image: ... - def gamma(self, exponent: float = ...) -> Image: ... - def gaussblur(self, sigma: float, min_ampl: float = ..., precision: Union[str, Precision] = ...) -> Image: ... + def gamma(self, *, exponent: float = ...) -> Image: ... + def gaussblur(self, sigma: float, *, min_ampl: float = ..., precision: str | Precision = ...) -> Image: ... @staticmethod - def gaussmat(sigma: float, min_ampl: float, separable: bool = ..., precision: Union[str, Precision] = ...) -> Image: ... + def gaussmat(sigma: float, min_ampl: float, *, separable: bool = ..., precision: str | Precision = ...) -> Image: ... @staticmethod - def gaussnoise(width: int, height: int, sigma: float = ..., mean: float = ..., seed: int = ...) -> Image: ... - def getpoint(self, x: int, y: int, unpack_complex: bool = ...) -> list[float]: ... + def gaussnoise(width: int, height: int, *, sigma: float = ..., mean: float = ..., seed: int = ...) -> Image: ... + def getpoint(self, x: int, y: int, *, unpack_complex: bool = ...) -> list[float]: ... @staticmethod - def gifload(filename: str, n: int = ..., page: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def gifload(filename: str | Path, *, n: int = ..., page: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def gifload_buffer(buffer: str, n: int = ..., page: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def gifload_buffer(buffer: _BufferLike, *, n: int = ..., page: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def gifload_source(source: Source, n: int = ..., page: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def gifsave(self, filename: str, dither: float = ..., effort: int = ..., bitdepth: int = ..., interframe_maxerror: float = ..., reuse: bool = ..., interpalette_maxerror: float = ..., interlace: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def gifsave_buffer(self, dither: float = ..., effort: int = ..., bitdepth: int = ..., interframe_maxerror: float = ..., reuse: bool = ..., interpalette_maxerror: float = ..., interlace: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def gifsave_target(self, target: Target, dither: float = ..., effort: int = ..., bitdepth: int = ..., interframe_maxerror: float = ..., reuse: bool = ..., interpalette_maxerror: float = ..., interlace: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def globalbalance(self, gamma: float = ..., int_output: bool = ...) -> Image: ... - def gravity(self, direction: Union[str, CompassDirection], width: int, height: int, extend: Union[str, Extend] = ..., background: list[float] = ...) -> Image: ... + def gifload_source(source: Source, *, n: int = ..., page: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def gifsave(self, filename: str | Path, *, dither: float = ..., effort: int = ..., bitdepth: int = ..., interframe_maxerror: float = ..., reuse: bool = ..., interpalette_maxerror: float = ..., interlace: bool = ..., keep_duplicate_frames: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def gifsave_buffer(self, *, dither: float = ..., effort: int = ..., bitdepth: int = ..., interframe_maxerror: float = ..., reuse: bool = ..., interpalette_maxerror: float = ..., interlace: bool = ..., keep_duplicate_frames: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def gifsave_target(self, target: Target, *, dither: float = ..., effort: int = ..., bitdepth: int = ..., interframe_maxerror: float = ..., reuse: bool = ..., interpalette_maxerror: float = ..., interlace: bool = ..., keep_duplicate_frames: bool = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def globalbalance(self, *, gamma: float = ..., int_output: bool = ...) -> Image: ... + def gravity(self, direction: str | CompassDirection, width: int, height: int, *, extend: str | Extend = ..., background: list[float] = ...) -> Image: ... @staticmethod - def grey(width: int, height: int, uchar: bool = ...) -> Image: ... + def grey(width: int, height: int, *, uchar: bool = ...) -> Image: ... def grid(self, tile_height: int, across: int, down: int) -> Image: ... @staticmethod - def heifload(filename: str, page: int = ..., n: int = ..., thumbnail: bool = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def heifload(filename: str | Path, *, page: int = ..., n: int = ..., thumbnail: bool = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def heifload_buffer(buffer: str, page: int = ..., n: int = ..., thumbnail: bool = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def heifload_buffer(buffer: _BufferLike, *, page: int = ..., n: int = ..., thumbnail: bool = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def heifload_source(source: Source, page: int = ..., n: int = ..., thumbnail: bool = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def heifsave(self, filename: str, Q: int = ..., bitdepth: int = ..., lossless: bool = ..., compression: Union[str, ForeignHeifCompression] = ..., effort: int = ..., subsample_mode: Union[str, ForeignSubsample] = ..., encoder: Union[str, ForeignHeifEncoder] = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def heifsave_buffer(self, Q: int = ..., bitdepth: int = ..., lossless: bool = ..., compression: Union[str, ForeignHeifCompression] = ..., effort: int = ..., subsample_mode: Union[str, ForeignSubsample] = ..., encoder: Union[str, ForeignHeifEncoder] = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def heifsave_target(self, target: Target, Q: int = ..., bitdepth: int = ..., lossless: bool = ..., compression: Union[str, ForeignHeifCompression] = ..., effort: int = ..., subsample_mode: Union[str, ForeignSubsample] = ..., encoder: Union[str, ForeignHeifEncoder] = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... + def heifload_source(source: Source, *, page: int = ..., n: int = ..., thumbnail: bool = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def heifsave(self, filename: str | Path, *, 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 = ...) -> None: ... + def heifsave_buffer(self, *, 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 = ...) -> bytes: ... + def heifsave_target(self, 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 = ...) -> None: ... def hist_cum(self) -> Image: ... def hist_entropy(self) -> float: ... - def hist_equal(self, band: int = ...) -> Image: ... - def hist_find(self, band: int = ...) -> Image: ... - def hist_find_indexed(self, index: Image, combine: Union[str, Combine] = ...) -> Image: ... - def hist_find_ndim(self, bins: int = ...) -> Image: ... + def hist_equal(self, *, band: int = ...) -> Image: ... + def hist_find(self, *, band: int = ...) -> Image: ... + def hist_find_indexed(self, index: Image, *, combine: str | Combine = ...) -> Image: ... + def hist_find_ndim(self, *, bins: int = ...) -> Image: ... def hist_ismonotonic(self) -> bool: ... - def hist_local(self, width: int, height: int, max_slope: int = ...) -> Image: ... + def hist_local(self, width: int, height: int, *, max_slope: int = ...) -> Image: ... def hist_match(self, ref: Image) -> Image: ... def hist_norm(self) -> Image: ... def hist_plot(self) -> Image: ... - def hough_circle(self, scale: int = ..., min_radius: int = ..., max_radius: int = ...) -> Image: ... - def hough_line(self, width: int = ..., height: int = ...) -> Image: ... - def icc_export(self, pcs: Union[str, PCS] = ..., intent: Union[str, Intent] = ..., black_point_compensation: bool = ..., output_profile: str = ..., depth: int = ...) -> Image: ... - def icc_import(self, pcs: Union[str, PCS] = ..., intent: Union[str, Intent] = ..., black_point_compensation: bool = ..., embedded: bool = ..., input_profile: str = ...) -> Image: ... - def icc_transform(self, output_profile: str, pcs: Union[str, PCS] = ..., intent: Union[str, Intent] = ..., black_point_compensation: bool = ..., embedded: bool = ..., input_profile: str = ..., depth: int = ...) -> Image: ... - @staticmethod - def identity(bands: int = ..., ushort: bool = ..., size: int = ...) -> Image: ... - def insert(self, sub: Image, x: int, y: int, expand: bool = ..., background: list[float] = ...) -> Image: ... + def hough_circle(self, *, scale: int = ..., min_radius: int = ..., max_radius: int = ...) -> Image: ... + def hough_line(self, *, width: int = ..., height: int = ...) -> Image: ... + def icc_export(self, *, pcs: str | PCS = ..., intent: str | Intent = ..., black_point_compensation: bool = ..., output_profile: str | Path = ..., depth: int = ...) -> Image: ... + def icc_import(self, *, pcs: str | PCS = ..., intent: str | Intent = ..., black_point_compensation: bool = ..., embedded: bool = ..., input_profile: str | Path = ...) -> Image: ... + def icc_transform(self, output_profile: str | Path, *, pcs: str | PCS = ..., intent: str | Intent = ..., black_point_compensation: bool = ..., embedded: bool = ..., input_profile: str | Path = ..., depth: int = ...) -> Image: ... + @staticmethod + def identity(*, bands: int = ..., ushort: bool = ..., size: int = ...) -> Image: ... + def insert(self, sub: Image, x: int, y: int, *, expand: bool = ..., background: list[float] = ...) -> Image: ... def invert(self) -> Image: ... - def invertlut(self, size: int = ...) -> Image: ... - def invfft(self, real: bool = ...) -> Image: ... - def join(self, in2: Image, direction: Union[str, Direction], expand: bool = ..., shim: int = ..., background: list[float] = ..., align: Union[str, Align] = ...) -> Image: ... + def invertlut(self, *, size: int = ...) -> Image: ... + def invfft(self, *, real: bool = ...) -> Image: ... + def join(self, in2: Image, direction: str | Direction, *, expand: bool = ..., shim: int = ..., background: list[float] = ..., align: str | Align = ...) -> Image: ... + @staticmethod + def jp2kload(filename: str | Path, *, page: int = ..., oneshot: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def jp2kload(filename: str, page: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def jp2kload_buffer(buffer: _BufferLike, *, page: int = ..., oneshot: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def jp2kload_buffer(buffer: str, page: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def jp2kload_source(source: Source, *, page: int = ..., oneshot: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def jp2ksave(self, filename: str | Path, *, 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 = ...) -> None: ... + def jp2ksave_buffer(self, *, 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 = ...) -> bytes: ... + def jp2ksave_target(self, 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 = ...) -> None: ... @staticmethod - def jp2kload_source(source: Source, page: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def jp2ksave(self, filename: str, 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 = ...) -> None: ... - def jp2ksave_buffer(self, 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 = ...) -> str: ... - def jp2ksave_target(self, 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 = ...) -> None: ... + def jpegload(filename: str | Path, *, shrink: int = ..., autorotate: bool = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def jpegload(filename: str, shrink: int = ..., autorotate: bool = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def jpegload_buffer(buffer: _BufferLike, *, shrink: int = ..., autorotate: bool = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def jpegload_buffer(buffer: str, shrink: int = ..., autorotate: bool = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def jpegload_source(source: Source, *, shrink: int = ..., autorotate: bool = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def jpegsave(self, filename: str | Path, *, 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 = ...) -> None: ... + def jpegsave_buffer(self, *, 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 = ...) -> bytes: ... + def jpegsave_mime(self, *, 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 = ...) -> None: ... + def jpegsave_target(self, 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 = ...) -> None: ... @staticmethod - def jpegload_source(source: Source, shrink: int = ..., autorotate: bool = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def jpegsave(self, filename: str, 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 = ...) -> None: ... - def jpegsave_buffer(self, 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 = ...) -> str: ... - def jpegsave_mime(self, 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 = ...) -> None: ... - def jpegsave_target(self, 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 = ...) -> None: ... + def jxlload(filename: str | Path, *, page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def jxlload(filename: str, page: int = ..., n: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + 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_buffer(buffer: str, page: int = ..., n: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + 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 = ..., 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: ... @staticmethod - def jxlload_source(source: Source, page: int = ..., n: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def jxlsave(self, filename: str, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def jxlsave_buffer(self, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def jxlsave_target(self, target: Target, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def labelregions(self, segments: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def linear(self, a: list[float], b: list[float], uchar: bool = ...) -> Image: ... - def linecache(self, tile_height: int = ..., access: Union[str, Access] = ..., threaded: bool = ..., persistent: bool = ...) -> Image: ... + def logmat(sigma: float, min_ampl: float, *, separable: bool = ..., precision: str | Precision = ...) -> Image: ... @staticmethod - def logmat(sigma: float, min_ampl: float, separable: bool = ..., precision: Union[str, Precision] = ...) -> Image: ... + def magickload(filename: str | Path, *, density: str = ..., page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def magickload(filename: str, density: str = ..., page: int = ..., n: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def magickload_buffer(buffer: _BufferLike, *, density: str = ..., page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def magickload_buffer(buffer: str, density: str = ..., page: int = ..., n: int = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def magicksave(self, filename: str, format: str = ..., quality: int = ..., optimize_gif_frames: bool = ..., optimize_gif_transparency: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def magicksave_buffer(self, format: str = ..., quality: int = ..., optimize_gif_frames: bool = ..., optimize_gif_transparency: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def mapim(self, index: Image, interpolate: GObject = ..., background: list[float] = ..., premultiplied: bool = ..., extend: Union[str, Extend] = ...) -> Image: ... - def maplut(self, lut: Image, band: int = ...) -> Image: ... + def magickload_source(source: Source, *, density: str = ..., page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def magicksave(self, filename: str | Path, *, format: str = ..., quality: int = ..., optimize_gif_frames: bool = ..., optimize_gif_transparency: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def magicksave_buffer(self, *, format: str = ..., quality: int = ..., optimize_gif_frames: bool = ..., optimize_gif_transparency: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def mapim(self, index: Image, *, interpolate: Interpolate = ..., background: list[float] = ..., premultiplied: bool = ..., extend: str | Extend = ...) -> Image: ... + def maplut(self, lut: Image, *, band: int = ...) -> Image: ... @staticmethod - def mask_butterworth(width: int, height: int, order: float, frequency_cutoff: float, amplitude_cutoff: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_butterworth(width: int, height: int, order: float, frequency_cutoff: float, amplitude_cutoff: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_butterworth_band(width: int, height: int, order: float, frequency_cutoff_x: float, frequency_cutoff_y: float, radius: float, amplitude_cutoff: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_butterworth_band(width: int, height: int, order: float, frequency_cutoff_x: float, frequency_cutoff_y: float, radius: float, amplitude_cutoff: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_butterworth_ring(width: int, height: int, order: float, frequency_cutoff: float, amplitude_cutoff: float, ringwidth: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_butterworth_ring(width: int, height: int, order: float, frequency_cutoff: float, amplitude_cutoff: float, ringwidth: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_fractal(width: int, height: int, fractal_dimension: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_fractal(width: int, height: int, fractal_dimension: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_gaussian(width: int, height: int, frequency_cutoff: float, amplitude_cutoff: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_gaussian(width: int, height: int, frequency_cutoff: float, amplitude_cutoff: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_gaussian_band(width: int, height: int, frequency_cutoff_x: float, frequency_cutoff_y: float, radius: float, amplitude_cutoff: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_gaussian_band(width: int, height: int, frequency_cutoff_x: float, frequency_cutoff_y: float, radius: float, amplitude_cutoff: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_gaussian_ring(width: int, height: int, frequency_cutoff: float, amplitude_cutoff: float, ringwidth: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_gaussian_ring(width: int, height: int, frequency_cutoff: float, amplitude_cutoff: float, ringwidth: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_ideal(width: int, height: int, frequency_cutoff: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_ideal(width: int, height: int, frequency_cutoff: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_ideal_band(width: int, height: int, frequency_cutoff_x: float, frequency_cutoff_y: float, radius: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def mask_ideal_band(width: int, height: int, frequency_cutoff_x: float, frequency_cutoff_y: float, radius: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... @staticmethod - def mask_ideal_ring(width: int, height: int, frequency_cutoff: float, ringwidth: float, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... - def match(self, sec: Image, xr1: int, yr1: int, xs1: int, ys1: int, xr2: int, yr2: int, xs2: int, ys2: int, hwindow: int = ..., harea: int = ..., search: bool = ..., interpolate: GObject = ...) -> Image: ... - def math(self, math: Union[str, OperationMath]) -> Image: ... - def math2(self, right: Image, math2: Union[str, OperationMath2]) -> Image: ... - def math2_const(self, math2: Union[str, OperationMath2], c: list[float]) -> Image: ... + def mask_ideal_ring(width: int, height: int, frequency_cutoff: float, ringwidth: float, *, uchar: bool = ..., nodc: bool = ..., reject: bool = ..., optical: bool = ...) -> Image: ... + def match(self, sec: Image, xr1: int, yr1: int, xs1: int, ys1: int, xr2: int, yr2: int, xs2: int, ys2: int, *, hwindow: int = ..., harea: int = ..., search: bool = ..., interpolate: Interpolate = ...) -> Image: ... + def math(self, math: str | OperationMath) -> Image: ... + def math2(self, right: Image, math2: str | OperationMath2) -> Image: ... + def math2_const(self, math2: str | OperationMath2, c: list[float]) -> Image: ... @staticmethod - def matload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def matload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... def matrixinvert(self) -> Image: ... @staticmethod - def matrixload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def matrixload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def matrixload_source(source: Source, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def matrixprint(self, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def matrixsave(self, filename: str, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def matrixsave_target(self, target: Target, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def max(self, size: int = ..., x: bool = ..., y: bool = ..., out_array: bool = ..., x_array: bool = ..., y_array: bool = ...) -> Union[float, tuple[float, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def matrixload_source(source: Source, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def matrixmultiply(self, right: Image) -> Image: ... + def matrixprint(self, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def matrixsave(self, filename: str | Path, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def matrixsave_target(self, target: Target, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def max(self, *, size: int = ..., x: bool = ..., y: bool = ..., out_array: bool = ..., x_array: bool = ..., y_array: bool = ...) -> float | tuple[float, _MetadataDict]: ... def maxpair(self, right: Image) -> Image: ... - def measure(self, h: int, v: int, left: int = ..., top: int = ..., width: int = ..., height: int = ...) -> Image: ... - def merge(self, sec: Image, direction: Union[str, Direction], dx: int, dy: int, mblend: int = ...) -> Image: ... - def min(self, size: int = ..., x: bool = ..., y: bool = ..., out_array: bool = ..., x_array: bool = ..., y_array: bool = ...) -> Union[float, tuple[float, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def measure(self, h: int, v: int, *, left: int = ..., top: int = ..., width: int = ..., height: int = ...) -> Image: ... + def merge(self, sec: Image, direction: str | Direction, dx: int, dy: int, *, mblend: int = ...) -> Image: ... + def min(self, *, size: int = ..., x: bool = ..., y: bool = ..., out_array: bool = ..., x_array: bool = ..., y_array: bool = ...) -> float | tuple[float, _MetadataDict]: ... def minpair(self, right: Image) -> Image: ... - def morph(self, mask: Image, morph: Union[str, OperationMorphology]) -> Image: ... - def mosaic(self, sec: Image, direction: Union[str, Direction], xref: int, yref: int, xsec: int, ysec: int, hwindow: int = ..., harea: int = ..., mblend: int = ..., bandno: int = ..., dx0: bool = ..., dy0: bool = ..., scale1: bool = ..., angle1: bool = ..., dy1: bool = ..., dx1: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def mosaic1(self, sec: Image, direction: Union[str, Direction], xr1: int, yr1: int, xs1: int, ys1: int, xr2: int, yr2: int, xs2: int, ys2: int, hwindow: int = ..., harea: int = ..., search: bool = ..., interpolate: GObject = ..., mblend: int = ...) -> Image: ... - def msb(self, band: int = ...) -> Image: ... + def morph(self, mask: Image, morph: str | OperationMorphology) -> Image: ... + def mosaic(self, sec: Image, direction: str | Direction, xref: int, yref: int, xsec: int, ysec: int, *, hwindow: int = ..., harea: int = ..., mblend: int = ..., bandno: int = ..., dx0: bool = ..., dy0: bool = ..., scale1: bool = ..., angle1: bool = ..., dy1: bool = ..., dx1: bool = ...) -> Image: ... + def mosaic1(self, sec: Image, direction: str | Direction, xr1: int, yr1: int, xs1: int, ys1: int, xr2: int, yr2: int, xs2: int, ys2: int, *, hwindow: int = ..., harea: int = ..., search: bool = ..., interpolate: Interpolate = ..., mblend: int = ...) -> Image: ... + def msb(self, *, band: int = ...) -> Image: ... def multiply(self, right: Image) -> Image: ... @staticmethod - def openexrload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def openexrload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def openslideload(filename: str, 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 = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def openslideload(filename: str | Path, *, level: int = ..., autocrop: bool = ..., associated: str = ..., attach_associated: bool = ..., rgb: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def openslideload_source(source: Source, 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 = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def openslideload_source(source: Source, *, level: int = ..., autocrop: bool = ..., associated: str = ..., attach_associated: bool = ..., rgb: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def pdfload(filename: str, page: int = ..., n: int = ..., dpi: float = ..., scale: float = ..., background: list[float] = ..., password: str = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def pdfload(filename: str | Path, *, 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: ... @staticmethod - def pdfload_buffer(buffer: str, page: int = ..., n: int = ..., dpi: float = ..., scale: float = ..., background: list[float] = ..., password: str = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def pdfload_buffer(buffer: _BufferLike, *, 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: ... @staticmethod - def pdfload_source(source: Source, page: int = ..., n: int = ..., dpi: float = ..., scale: float = ..., background: list[float] = ..., password: str = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + 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: ... @staticmethod - def perlin(width: int, height: int, cell_size: int = ..., uchar: bool = ..., seed: int = ...) -> Image: ... + def perlin(width: int, height: int, *, cell_size: int = ..., uchar: bool = ..., seed: int = ...) -> Image: ... def phasecor(self, in2: Image) -> Image: ... @staticmethod - def pngload(filename: str, unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def pngload(filename: str | Path, *, unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def pngload_buffer(buffer: str, unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def pngload_buffer(buffer: _BufferLike, *, unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def pngload_source(source: Source, unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def pngsave(self, filename: str, compression: int = ..., interlace: bool = ..., filter: int = ..., palette: bool = ..., Q: int = ..., dither: float = ..., bitdepth: int = ..., effort: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def pngsave_buffer(self, compression: int = ..., interlace: bool = ..., filter: int = ..., palette: bool = ..., Q: int = ..., dither: float = ..., bitdepth: int = ..., effort: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def pngsave_target(self, target: Target, compression: int = ..., interlace: bool = ..., filter: int = ..., palette: bool = ..., Q: int = ..., dither: float = ..., bitdepth: int = ..., effort: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... + def pngload_source(source: Source, *, unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def pngsave(self, filename: str | Path, *, compression: int = ..., interlace: bool = ..., filter: int = ..., palette: bool = ..., Q: int = ..., dither: float = ..., bitdepth: int = ..., effort: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def pngsave_buffer(self, *, compression: int = ..., interlace: bool = ..., filter: int = ..., palette: bool = ..., Q: int = ..., dither: float = ..., bitdepth: int = ..., effort: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def pngsave_target(self, target: Target, *, compression: int = ..., interlace: bool = ..., filter: int = ..., palette: bool = ..., Q: int = ..., dither: float = ..., bitdepth: int = ..., effort: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... @staticmethod - def ppmload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def ppmload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def ppmload_source(source: Source, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def ppmsave(self, filename: str, format: Union[str, ForeignPpmFormat] = ..., ascii: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def ppmsave_target(self, target: Target, format: Union[str, ForeignPpmFormat] = ..., ascii: bool = ..., bitdepth: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def premultiply(self, max_alpha: float = ...) -> Image: ... + def ppmload_buffer(buffer: _BufferLike, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + 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 = ...) -> Image: ... def prewitt(self) -> Image: ... def profile(self) -> tuple[Image, Image]: ... @staticmethod - def profile_load(name: str) -> str: ... + def profile_load(name: str) -> bytes: ... def project(self) -> tuple[Image, Image]: ... - def quadratic(self, coeff: Image, interpolate: GObject = ...) -> Image: ... + def quadratic(self, coeff: Image, *, interpolate: Interpolate = ...) -> Image: ... def rad2float(self) -> Image: ... @staticmethod - def radload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def radload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def radload_buffer(buffer: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def radload_buffer(buffer: _BufferLike, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def radload_source(source: Source, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def radsave(self, filename: str, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def radsave_buffer(self, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def radsave_target(self, target: Target, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... + def radload_source(source: Source, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def radsave(self, filename: str | Path, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def radsave_buffer(self, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def radsave_target(self, target: Target, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... def rank(self, width: int, height: int, index: int) -> Image: ... @staticmethod - def rawload(filename: str, width: int, height: int, bands: int, offset: int = ..., format: Union[str, BandFormat] = ..., interpretation: Union[str, Interpretation] = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def rawsave(self, filename: str, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def rawsave_buffer(self, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> str: ... - def rawsave_target(self, target: Target, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... + def rawload(filename: str | Path, width: int, height: int, bands: int, *, offset: int = ..., format: str | BandFormat = ..., interpretation: str | Interpretation = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def rawsave(self, filename: str | Path, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def rawsave_buffer(self, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def rawsave_target(self, target: Target, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... def recomb(self, m: Image) -> Image: ... - def reduce(self, hshrink: float, vshrink: float, kernel: Union[str, Kernel] = ..., gap: float = ...) -> Image: ... - def reduceh(self, hshrink: float, kernel: Union[str, Kernel] = ..., gap: float = ...) -> Image: ... - def reducev(self, vshrink: float, kernel: Union[str, Kernel] = ..., gap: float = ...) -> Image: ... - def relational(self, right: Image, relational: Union[str, OperationRelational]) -> Image: ... - def relational_const(self, relational: Union[str, OperationRelational], c: list[float]) -> Image: ... + def reduce(self, hshrink: float, vshrink: float, *, kernel: str | Kernel = ..., gap: float = ...) -> Image: ... + def reduceh(self, hshrink: float, *, kernel: str | Kernel = ..., gap: float = ...) -> Image: ... + def reducev(self, vshrink: float, *, kernel: str | Kernel = ..., gap: float = ...) -> Image: ... + def relational(self, right: Image, relational: str | OperationRelational) -> Image: ... + def relational_const(self, relational: str | OperationRelational, c: list[float]) -> Image: ... def remainder(self, right: Image) -> Image: ... def remainder_const(self, c: list[float]) -> Image: ... + def remosaic(self, old_str: str, new_str: str) -> Image: ... def replicate(self, across: int, down: int) -> Image: ... - def resize(self, scale: float, kernel: Union[str, Kernel] = ..., gap: float = ..., vscale: float = ...) -> Image: ... - def rot(self, angle: Union[str, Angle]) -> Image: ... - def rot45(self, angle: Union[str, Angle45] = ...) -> Image: ... - def rotate(self, angle: float, interpolate: GObject = ..., background: list[float] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ...) -> Image: ... - def round(self, round: Union[str, OperationRound]) -> Image: ... + def resize(self, scale: float, *, kernel: str | Kernel = ..., gap: float = ..., vscale: float = ...) -> Image: ... + def rot(self, angle: str | Angle) -> Image: ... + def rot45(self, *, angle: str | Angle45 = ...) -> Image: ... + def rotate(self, angle: float, *, interpolate: Interpolate = ..., background: list[float] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ...) -> Image: ... + def round(self, round: str | OperationRound) -> Image: ... def sRGB2HSV(self) -> Image: ... def sRGB2scRGB(self) -> Image: ... - def scRGB2BW(self, depth: int = ...) -> Image: ... + def scRGB2BW(self, *, depth: int = ...) -> Image: ... def scRGB2XYZ(self) -> Image: ... - def scRGB2sRGB(self, depth: int = ...) -> Image: ... + def scRGB2sRGB(self, *, depth: int = ...) -> Image: ... def scharr(self) -> Image: ... @staticmethod - def sdf(width: int, height: int, shape: Union[str, SdfShape], r: float = ..., a: list[float] = ..., b: list[float] = ..., corners: list[float] = ...) -> Image: ... - def sequential(self, tile_height: int = ...) -> Image: ... - def sharpen(self, sigma: float = ..., x1: float = ..., y2: float = ..., y3: float = ..., m1: float = ..., m2: float = ...) -> Image: ... - def shrink(self, hshrink: float, vshrink: float, ceil: bool = ...) -> Image: ... - def shrinkh(self, hshrink: int, ceil: bool = ...) -> Image: ... - def shrinkv(self, vshrink: int, ceil: bool = ...) -> Image: ... + def sdf(width: int, height: int, shape: str | SdfShape, *, r: float = ..., a: list[float] = ..., b: list[float] = ..., corners: list[float] = ...) -> Image: ... + def sequential(self, *, tile_height: int = ...) -> Image: ... + def sharpen(self, *, sigma: float = ..., x1: float = ..., y2: float = ..., y3: float = ..., m1: float = ..., m2: float = ...) -> Image: ... + def shrink(self, hshrink: float, vshrink: float, *, ceil: bool = ...) -> Image: ... + def shrinkh(self, hshrink: int, *, ceil: bool = ...) -> Image: ... + def shrinkv(self, vshrink: int, *, ceil: bool = ...) -> Image: ... def sign(self) -> Image: ... - def similarity(self, scale: float = ..., angle: float = ..., interpolate: GObject = ..., background: list[float] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ...) -> Image: ... + 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: Union[str, Interesting] = ..., premultiplied: bool = ..., attention_x: bool = ..., attention_y: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def sines(width: int, height: int, *, uchar: bool = ..., hfreq: float = ..., vfreq: float = ...) -> 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: ... def stats(self) -> Image: ... - def stdif(self, width: int, height: int, s0: float = ..., b: float = ..., m0: float = ..., a: float = ...) -> Image: ... - def subsample(self, xfac: int, yfac: int, point: bool = ...) -> Image: ... + def stdif(self, width: int, height: int, *, s0: float = ..., b: float = ..., m0: float = ..., a: float = ...) -> Image: ... + def subsample(self, xfac: int, yfac: int, *, point: bool = ...) -> Image: ... def subtract(self, right: Image) -> Image: ... @staticmethod def sum(in_: list[Image]) -> Image: ... @staticmethod - def svgload(filename: str, dpi: float = ..., scale: float = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def svgload(filename: str | Path, *, dpi: float = ..., scale: float = ..., unlimited: bool = ..., stylesheet: str = ..., high_bitdepth: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def svgload_buffer(buffer: str, dpi: float = ..., scale: float = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def svgload_buffer(buffer: _BufferLike, *, dpi: float = ..., scale: float = ..., unlimited: bool = ..., stylesheet: str = ..., high_bitdepth: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def svgload_source(source: Source, dpi: float = ..., scale: float = ..., unlimited: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def svgload_source(source: Source, *, dpi: float = ..., scale: float = ..., unlimited: bool = ..., stylesheet: str = ..., high_bitdepth: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod def switch(tests: list[Image]) -> Image: ... @staticmethod - def system(cmd_format: str, in_: list[Image] = ..., out_format: str = ..., in_format: str = ..., out: bool = ..., log: bool = ...) -> Union[None, tuple[Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def system(cmd_format: str, *, in_: list[Image] = ..., in_format: str = ..., out_format: str = ..., cache: bool = ..., out: bool = ..., log: bool = ...) -> None | tuple[_MetadataDict]: ... + @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 = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... @staticmethod - def text(text: str, 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 = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[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(filename: str, width: int, height: int = ..., size: Union[str, Size] = ..., no_rotate: bool = ..., crop: Union[str, Interesting] = ..., linear: bool = ..., import_profile: str = ..., export_profile: str = ..., intent: Union[str, Intent] = ..., fail_on: Union[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 thumbnail_buffer(buffer: str, width: int, option_string: str = ..., height: int = ..., size: Union[str, Size] = ..., no_rotate: bool = ..., crop: Union[str, Interesting] = ..., linear: bool = ..., import_profile: str = ..., export_profile: str = ..., intent: Union[str, Intent] = ..., fail_on: Union[str, FailOn] = ...) -> Image: ... - def thumbnail_image(self, width: int, height: int = ..., size: Union[str, Size] = ..., no_rotate: bool = ..., crop: Union[str, Interesting] = ..., linear: bool = ..., import_profile: str = ..., export_profile: str = ..., intent: Union[str, Intent] = ..., fail_on: Union[str, FailOn] = ...) -> Image: ... + 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 - def thumbnail_source(source: Source, width: int, option_string: str = ..., height: int = ..., size: Union[str, Size] = ..., no_rotate: bool = ..., crop: Union[str, Interesting] = ..., linear: bool = ..., import_profile: str = ..., export_profile: str = ..., intent: Union[str, Intent] = ..., fail_on: Union[str, FailOn] = ...) -> Image: ... + def tiffload_buffer(buffer: _BufferLike, *, 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 - def tiffload(filename: str, page: int = ..., subifd: int = ..., n: int = ..., autorotate: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def tiffload_source(source: Source, *, page: int = ..., n: int = ..., autorotate: bool = ..., subifd: int = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def tiffsave(self, filename: str | Path, *, 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 = ...) -> None: ... + def tiffsave_buffer(self, *, 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 = ...) -> bytes: ... + def tiffsave_target(self, 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 = ...) -> None: ... + def tilecache(self, *, tile_width: int = ..., tile_height: int = ..., max_tiles: int = ..., access: str | Access = ..., threaded: bool = ..., persistent: bool = ...) -> Image: ... @staticmethod - def tiffload_buffer(buffer: str, page: int = ..., subifd: int = ..., n: int = ..., autorotate: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + 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: ... @staticmethod - def tiffload_source(source: Source, page: int = ..., subifd: int = ..., n: int = ..., autorotate: bool = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def tiffsave(self, filename: str, 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 = ...) -> None: ... - def tiffsave_buffer(self, 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 = ...) -> str: ... - def tiffsave_target(self, 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 = ...) -> None: ... - def tilecache(self, tile_width: int = ..., tile_height: int = ..., max_tiles: int = ..., access: Union[str, Access] = ..., threaded: bool = ..., persistent: bool = ...) -> Image: ... + def uhdrload(filename: str | Path, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - 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 unpremultiply(self, max_alpha: float = ..., alpha_band: int = ...) -> Image: ... + def uhdrload_buffer(buffer: _BufferLike, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def vipsload(filename: str, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + 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_source(source: Source, memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def vipssave(self, filename: str, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... - def vipssave_target(self, target: Target, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str = ...) -> None: ... + def vipsload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def webpload(filename: str, page: int = ..., n: int = ..., scale: float = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def vipsload_source(source: Source, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def vipssave(self, filename: str | Path, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def vipssave_target(self, target: Target, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... @staticmethod - def webpload_buffer(buffer: str, page: int = ..., n: int = ..., scale: float = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + def webpload(filename: str | Path, *, page: int = ..., n: int = ..., scale: float = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def webpload_source(source: Source, page: int = ..., n: int = ..., scale: float = ..., memory: bool = ..., access: Union[str, Access] = ..., fail_on: Union[str, FailOn] = ..., revalidate: bool = ..., flags: bool = ...) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... - def webpsave(self, filename: str, Q: int = ..., lossless: 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 = ...) -> None: ... - def webpsave_buffer(self, Q: int = ..., lossless: 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 = ...) -> str: ... - def webpsave_mime(self, Q: int = ..., lossless: 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 = ...) -> None: ... - def webpsave_target(self, target: Target, Q: int = ..., lossless: 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 = ...) -> None: ... + def webpload_buffer(buffer: _BufferLike, *, page: int = ..., n: int = ..., scale: float = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... @staticmethod - def worley(width: int, height: int, cell_size: int = ..., seed: int = ...) -> Image: ... - def wrap(self, x: int = ..., y: int = ...) -> Image: ... + def webpload_source(source: Source, *, page: int = ..., n: int = ..., scale: float = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def webpsave(self, filename: str | Path, *, 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 = ...) -> None: ... + def webpsave_buffer(self, *, 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 = ...) -> bytes: ... + def webpsave_mime(self, *, 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 = ...) -> None: ... + def webpsave_target(self, 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 = ...) -> None: ... @staticmethod - def xyz(width: int, height: int, csize: int = ..., dsize: int = ..., esize: int = ...) -> Image: ... + def worley(width: int, height: int, *, cell_size: int = ..., seed: int = ...) -> Image: ... + def wrap(self, *, x: int = ..., y: int = ...) -> Image: ... @staticmethod - def zone(width: int, height: int, uchar: bool = ...) -> Image: ... + def xyz(width: int, height: int, *, csize: int = ..., dsize: int = ..., esize: int = ...) -> Image: ... + @staticmethod + def zone(width: int, height: int, *, uchar: bool = ...) -> Image: ... def zoom(self, xfac: int, yfac: int) -> Image: ... - # Operator overloads - def __add__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __radd__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __sub__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rsub__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __mul__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rmul__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __truediv__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rtruediv__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __floordiv__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rfloordiv__(self, other: Union[float, int, List[float], List[int]]) -> Image: ... - def __mod__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __pow__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rpow__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... + # Operators + def __repr__(self) -> str: ... + def __getattr__(self, name: str) -> Any: ... + def __enter__(self) -> Image: ... + def __exit__(self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None) -> None: ... + def __getitem__(self, arg: int | slice | list[int] | list[bool]) -> Image: ... + def __call__(self, x: int, y: int) -> list[float]: ... + # Arithmetic operators + def __add__(self, other: _ImageOperand) -> Image: ... + def __radd__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __sub__(self, other: _ImageOperand) -> Image: ... + def __rsub__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __mul__(self, other: _ImageOperand) -> Image: ... + def __rmul__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __div__(self, other: _ImageOperand) -> Image: ... + def __rdiv__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __truediv__(self, other: _ImageOperand) -> Image: ... + def __rtruediv__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __floordiv__(self, other: _ImageOperand) -> Image: ... + def __rfloordiv__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __mod__(self, other: _ImageOperand) -> Image: ... + def __pow__(self, other: _ImageOperand) -> Image: ... + def __rpow__(self, other: _ImageOperand) -> Image: ... def __abs__(self) -> Image: ... + def __lshift__(self, other: _ImageOperand) -> Image: ... + def __rshift__(self, other: _ImageOperand) -> Image: ... + def __and__(self, other: _ImageOperand) -> Image: ... + def __rand__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __or__(self, other: _ImageOperand) -> Image: ... + def __ror__(self, other: _NumberLike | _NumberLikeList) -> Image: ... + def __xor__(self, other: _ImageOperand) -> Image: ... + def __rxor__(self, other: _NumberLike | _NumberLikeList) -> Image: ... def __neg__(self) -> Image: ... def __pos__(self) -> Image: ... def __invert__(self) -> Image: ... - def __lshift__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rshift__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __and__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rand__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __or__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __ror__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __xor__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __rxor__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __gt__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __ge__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __lt__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - def __le__(self, other: Union[Image, float, int, List[float], List[int]]) -> Image: ... - - def __getitem__(self, arg: Union[int, slice, List[int], List[bool]]) -> Image: ... - def __call__(self, x: int, y: int) -> List[float]: ... - def __repr__(self) -> str: ... + # Comparison operators + def __gt__(self, other: _ImageOperand) -> Image: ... + def __ge__(self, other: _ImageOperand) -> Image: ... + def __lt__(self, other: _ImageOperand) -> Image: ... + def __le__(self, other: _ImageOperand) -> Image: ... + def __eq__(self, other: Any) -> bool | Image: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def __ne__(self, other: Any) -> bool | Image: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + + # Compatibility (deprecated) methods + def get_value(self, name: str) -> _MetadataValue: ... + def set_value(self, name: str, value: _MetadataValue) -> None: ... + def get_scale(self) -> float: ... + def get_offset(self) -> float: ... + +class Operation(VipsObject): + @staticmethod + def new_from_name(operation_name: str) -> "Operation": ... + def set(self, name: str, flags: int, match_image: Image | None, value: Any) -> None: ... + @staticmethod + def call(operation_name: str, *args: Any, **kwargs: Any) -> Any: ... + @staticmethod + def generate_docstring(operation_name: str) -> str: ... + @staticmethod + def generate_sphinx(operation_name: str) -> str: ... + @staticmethod + def generate_sphinx_all() -> None: ... + +class Introspect(object): + description: str + flags: int + details: dict[str, dict[str, Any]] + required_input: list[str] + optional_input: list[str] + required_output: list[str] + optional_output: list[str] -class Operation: ... -class Introspect: ... + doc_optional_input: list[str] + doc_optional_output: list[str] + + member_x: str | None + method_args: list[str] + + def __init__(self, operation_name: str) -> None: ... + @classmethod + def get(cls: type["Introspect"], operation_name: str) -> "Introspect": ... # Global functions + +# base.py +def _to_string(cdata: Any) -> str: ... +def _to_bytes(value: object) -> bytes: ... +def leak_set(leak: bool) -> None: ... +def shutdown() -> None: ... +def version(flag: int) -> int: ... +def get_suffixes() -> list[str]: ... +def at_least_libvips(x: int, y: int) -> bool: ... +def type_find(basename: str, nickname: str) -> int: ... +def type_name(gtype: int) -> str: ... +def nickname_find(gtype: int) -> str: ... +def type_from_name(name: str) -> int: ... +def type_map(gtype: int, fn: Callable[..., int]) -> int: ... +def values_for_enum(gtype: int) -> list[str]: ... +def values_for_flag(gtype: int) -> list[str]: ... +def enum_dict(gtype: int) -> dict[str, int]: ... +def flags_dict(gtype: int) -> dict[str, int]: ... + +# voperation.py def cache_set_max(mx: int) -> None: ... def cache_set_max_mem(mx: int) -> None: ... def cache_set_max_files(mx: int) -> None: ... @@ -649,9 +784,8 @@ def cache_get_max_mem() -> int: ... def cache_get_max_files() -> int: ... def block_untrusted_set(state: bool) -> None: ... def operation_block_set(name: str, state: bool) -> None: ... -def leak_set(leak: bool) -> None: ... -def shutdown() -> None: ... -def call(operation_name: str, *args: object, **kwargs: object) -> Union[Image, tuple[Image, Dict[str, Union[bool, int, float, str, Image, list[int], list[float], list[Image]]]]]: ... + +def call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, _MetadataDict]: ... # Module-level constants API_mode: bool diff --git a/pyvips/enums.pyi b/pyvips/enums.pyi new file mode 100644 index 0000000..d030624 --- /dev/null +++ b/pyvips/enums.pyi @@ -0,0 +1,348 @@ +class Access: + RANDOM: str = 'random' + SEQUENTIAL: str = 'sequential' + SEQUENTIAL_UNBUFFERED: str = 'sequential-unbuffered' + +class Align: + LOW: str = 'low' + CENTRE: str = 'centre' + HIGH: str = 'high' + +class Angle: + D0: str = 'd0' + D90: str = 'd90' + D180: str = 'd180' + D270: str = 'd270' + +class Angle45: + D0: str = 'd0' + D45: str = 'd45' + D90: str = 'd90' + D135: str = 'd135' + D180: str = 'd180' + D225: str = 'd225' + D270: str = 'd270' + D315: str = 'd315' + +class BandFormat: + NOTSET: str = 'notset' + UCHAR: str = 'uchar' + CHAR: str = 'char' + USHORT: str = 'ushort' + SHORT: str = 'short' + UINT: str = 'uint' + INT: str = 'int' + FLOAT: str = 'float' + COMPLEX: str = 'complex' + DOUBLE: str = 'double' + DPCOMPLEX: str = 'dpcomplex' + +class BlendMode: + CLEAR: str = 'clear' + SOURCE: str = 'source' + OVER: str = 'over' + IN: str = 'in' + OUT: str = 'out' + ATOP: str = 'atop' + DEST: str = 'dest' + DEST_OVER: str = 'dest-over' + DEST_IN: str = 'dest-in' + DEST_OUT: str = 'dest-out' + DEST_ATOP: str = 'dest-atop' + XOR: str = 'xor' + ADD: str = 'add' + SATURATE: str = 'saturate' + MULTIPLY: str = 'multiply' + SCREEN: str = 'screen' + OVERLAY: str = 'overlay' + DARKEN: str = 'darken' + LIGHTEN: str = 'lighten' + COLOUR_DODGE: str = 'colour-dodge' + COLOUR_BURN: str = 'colour-burn' + HARD_LIGHT: str = 'hard-light' + SOFT_LIGHT: str = 'soft-light' + DIFFERENCE: str = 'difference' + EXCLUSION: str = 'exclusion' + +class Coding: + ERROR: str = 'error' + NONE: str = 'none' + LABQ: str = 'labq' + RAD: str = 'rad' + +class Combine: + MAX: str = 'max' + SUM: str = 'sum' + MIN: str = 'min' + +class CombineMode: + SET: str = 'set' + ADD: str = 'add' + +class CompassDirection: + CENTRE: str = 'centre' + NORTH: str = 'north' + EAST: str = 'east' + SOUTH: str = 'south' + WEST: str = 'west' + NORTH_EAST: str = 'north-east' + SOUTH_EAST: str = 'south-east' + SOUTH_WEST: str = 'south-west' + NORTH_WEST: str = 'north-west' + +class Direction: + HORIZONTAL: str = 'horizontal' + VERTICAL: str = 'vertical' + +class Extend: + BLACK: str = 'black' + COPY: str = 'copy' + REPEAT: str = 'repeat' + MIRROR: str = 'mirror' + WHITE: str = 'white' + BACKGROUND: str = 'background' + +class FailOn: + NONE: str = 'none' + TRUNCATED: str = 'truncated' + ERROR: str = 'error' + WARNING: str = 'warning' + +class ForeignDzContainer: + FS: str = 'fs' + ZIP: str = 'zip' + SZI: str = 'szi' + +class ForeignDzDepth: + ONEPIXEL: str = 'onepixel' + ONETILE: str = 'onetile' + ONE: str = 'one' + +class ForeignDzLayout: + DZ: str = 'dz' + ZOOMIFY: str = 'zoomify' + GOOGLE: str = 'google' + IIIF: str = 'iiif' + IIIF3: str = 'iiif3' + +class ForeignHeifCompression: + HEVC: str = 'hevc' + AVC: str = 'avc' + JPEG: str = 'jpeg' + AV1: str = 'av1' + +class ForeignHeifEncoder: + AUTO: str = 'auto' + AOM: str = 'aom' + RAV1E: str = 'rav1e' + SVT: str = 'svt' + X265: str = 'x265' + +class ForeignKeep: + NONE: int = 0 + EXIF: int = 1 + XMP: int = 2 + IPTC: int = 4 + ICC: int = 8 + OTHER: int = 16 + GAINMAP: int = 32 + ALL: int = 63 + +class ForeignPdfPageBox: + MEDIA: str = 'media' + CROP: str = 'crop' + TRIM: str = 'trim' + BLEED: str = 'bleed' + ART: str = 'art' + +class ForeignPngFilter: + NONE: int = 8 + SUB: int = 16 + UP: int = 32 + AVG: int = 64 + PAETH: int = 128 + ALL: int = 248 + +class ForeignPpmFormat: + PBM: str = 'pbm' + PGM: str = 'pgm' + PPM: str = 'ppm' + PFM: str = 'pfm' + PNM: str = 'pnm' + +class ForeignSubsample: + AUTO: str = 'auto' + ON: str = 'on' + OFF: str = 'off' + +class ForeignTiffCompression: + NONE: str = 'none' + JPEG: str = 'jpeg' + DEFLATE: str = 'deflate' + PACKBITS: str = 'packbits' + CCITTFAX4: str = 'ccittfax4' + LZW: str = 'lzw' + WEBP: str = 'webp' + ZSTD: str = 'zstd' + JP2K: str = 'jp2k' + +class ForeignTiffPredictor: + NONE: str = 'none' + HORIZONTAL: str = 'horizontal' + FLOAT: str = 'float' + +class ForeignTiffResunit: + CM: str = 'cm' + INCH: str = 'inch' + +class ForeignWebpPreset: + DEFAULT: str = 'default' + PICTURE: str = 'picture' + PHOTO: str = 'photo' + DRAWING: str = 'drawing' + ICON: str = 'icon' + TEXT: str = 'text' + +class Intent: + PERCEPTUAL: str = 'perceptual' + RELATIVE: str = 'relative' + SATURATION: str = 'saturation' + ABSOLUTE: str = 'absolute' + AUTO: str = 'auto' + +class Interesting: + NONE: str = 'none' + CENTRE: str = 'centre' + ENTROPY: str = 'entropy' + ATTENTION: str = 'attention' + LOW: str = 'low' + HIGH: str = 'high' + ALL: str = 'all' + +class Interpretation: + ERROR: str = 'error' + MULTIBAND: str = 'multiband' + B_W: str = 'b-w' + HISTOGRAM: str = 'histogram' + XYZ: str = 'xyz' + LAB: str = 'lab' + CMYK: str = 'cmyk' + LABQ: str = 'labq' + RGB: str = 'rgb' + CMC: str = 'cmc' + LCH: str = 'lch' + LABS: str = 'labs' + SRGB: str = 'srgb' + YXY: str = 'yxy' + FOURIER: str = 'fourier' + RGB16: str = 'rgb16' + GREY16: str = 'grey16' + MATRIX: str = 'matrix' + SCRGB: str = 'scrgb' + HSV: str = 'hsv' + OKLAB: str = 'oklab' + OKLCH: str = 'oklch' + +class Kernel: + NEAREST: str = 'nearest' + LINEAR: str = 'linear' + CUBIC: str = 'cubic' + MITCHELL: str = 'mitchell' + LANCZOS2: str = 'lanczos2' + LANCZOS3: str = 'lanczos3' + MKS2013: str = 'mks2013' + MKS2021: str = 'mks2021' + +class OperationBoolean: + AND: str = 'and' + OR: str = 'or' + EOR: str = 'eor' + LSHIFT: str = 'lshift' + RSHIFT: str = 'rshift' + +class OperationComplex: + POLAR: str = 'polar' + RECT: str = 'rect' + CONJ: str = 'conj' + +class OperationComplex2: + CROSS_PHASE: str = 'cross-phase' + +class OperationComplexget: + REAL: str = 'real' + IMAG: str = 'imag' + +class OperationMath: + SIN: str = 'sin' + COS: str = 'cos' + TAN: str = 'tan' + ASIN: str = 'asin' + ACOS: str = 'acos' + ATAN: str = 'atan' + LOG: str = 'log' + LOG10: str = 'log10' + EXP: str = 'exp' + EXP10: str = 'exp10' + SINH: str = 'sinh' + COSH: str = 'cosh' + TANH: str = 'tanh' + ASINH: str = 'asinh' + ACOSH: str = 'acosh' + ATANH: str = 'atanh' + +class OperationMath2: + POW: str = 'pow' + WOP: str = 'wop' + ATAN2: str = 'atan2' + +class OperationMorphology: + ERODE: str = 'erode' + DILATE: str = 'dilate' + +class OperationRelational: + EQUAL: str = 'equal' + NOTEQ: str = 'noteq' + LESS: str = 'less' + LESSEQ: str = 'lesseq' + MORE: str = 'more' + MOREEQ: str = 'moreeq' + +class OperationRound: + RINT: str = 'rint' + CEIL: str = 'ceil' + FLOOR: str = 'floor' + +class PCS: + LAB: str = 'lab' + XYZ: str = 'xyz' + +class Precision: + INTEGER: str = 'integer' + FLOAT: str = 'float' + APPROXIMATE: str = 'approximate' + +class RegionShrink: + MEAN: str = 'mean' + MEDIAN: str = 'median' + MODE: str = 'mode' + MAX: str = 'max' + MIN: str = 'min' + NEAREST: str = 'nearest' + +class SdfShape: + CIRCLE: str = 'circle' + BOX: str = 'box' + ROUNDED_BOX: str = 'rounded-box' + LINE: str = 'line' + +class Size: + BOTH: str = 'both' + UP: str = 'up' + DOWN: str = 'down' + FORCE: str = 'force' + +class TextWrap: + WORD: str = 'word' + CHAR: str = 'char' + WORD_CHAR: str = 'word-char' + NONE: str = 'none' \ No newline at end of file diff --git a/pyvips/gvalue.py b/pyvips/gvalue.py index 04069e8..969f647 100644 --- a/pyvips/gvalue.py +++ b/pyvips/gvalue.py @@ -54,7 +54,7 @@ class GValue(object): _gtype_to_python = { gbool_type: 'bool', gint_type: 'int', - guint64_type: 'long', # Note: int and long are unified in Python 3 + guint64_type: 'int', gdouble_type: 'float', gstr_type: 'str', refstr_type: 'str', @@ -65,7 +65,7 @@ class GValue(object): array_int_type: 'list[int]', array_double_type: 'list[float]', array_image_type: 'list[Image]', - blob_type: 'str', + blob_type: 'bytes', source_type: 'Source', target_type: 'Target', } @@ -84,7 +84,7 @@ def gtype_to_python(gtype): name = type_name(gtype) if name.startswith('Vips'): name = name[4:] - return f"Union[str, {name}]" + return f"str | {name}" if gtype in GValue._gtype_to_python: return GValue._gtype_to_python[gtype] if fundamental in GValue._gtype_to_python: diff --git a/pyvips/voperation.py b/pyvips/voperation.py index 4d1b37d..77f299c 100644 --- a/pyvips/voperation.py +++ b/pyvips/voperation.py @@ -144,7 +144,7 @@ def add_construct(self, pspec, argument_class, self.method_args = self.required_input # a hash mapping operation names to introspection data - _introspect_cache = {} + _introspect_cache = {} # type: ignore[var-annotated] @classmethod def get(cls, operation_name): @@ -179,7 +179,7 @@ class Operation(pyvips.VipsObject): __slots__ = () # cache nickname -> docstring here - _docstring_cache = {} + _docstring_cache = {} # type: ignore[var-annotated] def __init__(self, pointer): # logger.debug('Operation.__init__: pointer = %s', pointer) @@ -337,6 +337,15 @@ def set_reference(x): return result + @staticmethod + def _argtype_to_python(name: str, type): + if ( + name in ("filename", "input_profile", "output_profile", "profile") + and type == GValue.gstr_type + ): + return "str | Path" + return GValue.gtype_to_python(type) + @staticmethod def generate_docstring(operation_name): """Make a google-style docstring. @@ -365,8 +374,10 @@ def generate_docstring(operation_name): args = [] args += intro.method_args - args += [x + '=' + GValue.gtype_to_python(intro.details[x]['type']) - for x in intro.doc_optional_input] + args += [ + x + '=' + Operation._argtype_to_python(x, intro.details[x]['type']) + for x in intro.doc_optional_input + ] args += [x + '=bool' for x in intro.doc_optional_output] result += ", ".join(args) + ')\n' @@ -375,7 +386,7 @@ def argstr(name): details = intro.details[name] return (u' {0} ({1}): {2}\n'. format(name, - GValue.gtype_to_python(details['type']), + Operation._argtype_to_python(name, details['type']), details['blurb'])) result += '\nReturns:\n' @@ -431,8 +442,10 @@ def generate_sphinx(operation_name): result = '.. staticmethod:: ' args = [] args += intro.method_args - args += [x + '=' + GValue.gtype_to_python(intro.details[x]['type']) - for x in doc_optional_input] + args += [ + x + '=' + Operation._argtype_to_python(x, intro.details[x]['type']) + for x in doc_optional_input + ] args += [x + '=bool' for x in intro.doc_optional_output] result += operation_name + '(' + ", ".join(args) + ')\n\n' @@ -450,23 +463,29 @@ def generate_sphinx(operation_name): result += 'pyvips.Image.' + operation_name + '(' args = [] args += intro.method_args - args += [x + '=' + GValue.gtype_to_python(intro.details[x]['type']) - for x in doc_optional_input] + args += [ + x + '=' + Operation._argtype_to_python(x, intro.details[x]['type']) + for x in doc_optional_input + ] result += ', '.join(args) result += ')\n\n' for name in intro.method_args + doc_optional_input: details = intro.details[name] result += f':param {name}: {details["blurb"]}\n' - result += (f':type {name}: ' - f'{GValue.gtype_to_python(details["type"])}\n') + result += ( + f':type {name}: ' + f'{Operation._argtype_to_python(name, details["type"])}\n' + ) for name in intro.doc_optional_output: result += (f':param {name}: ' f'enable output: {intro.details[name]["blurb"]}\n') result += f':type {name}: bool\n' - output_types = [GValue.gtype_to_python(intro.details[name]['type']) - for name in intro.required_output] + output_types = [ + Operation._argtype_to_python(name, intro.details[name]['type']) + for name in intro.required_output + ] if len(output_types) == 1: output_type = output_types[0] else: