From ab3980efae668e0d9ee047231181213da2e286cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kurt=20B=C3=B6hm?= Date: Thu, 9 Jul 2026 07:52:31 +0200 Subject: [PATCH 1/2] Split the `pyi` stubs up and add more typing information --- examples/generate_type_stubs.py | 248 ++++------ pyvips/__init__.pyi | 825 ++------------------------------ pyvips/base.pyi | 16 + pyvips/enums.pyi | 2 +- pyvips/error.pyi | 16 + pyvips/gobject.pyi | 14 + pyvips/gvalue.pyi | 46 ++ pyvips/vconnection.pyi | 11 + pyvips/vimage.pyi | 562 ++++++++++++++++++++++ pyvips/vinterpolate.pyi | 8 + pyvips/vobject.pyi | 22 + pyvips/voperation.pyi | 75 +++ pyvips/vregion.pyi | 12 + pyvips/vsource.pyi | 18 + pyvips/vsourcecustom.pyi | 11 + pyvips/vtarget.pyi | 15 + pyvips/vtargetcustom.pyi | 16 + 17 files changed, 964 insertions(+), 953 deletions(-) create mode 100644 pyvips/base.pyi create mode 100644 pyvips/error.pyi create mode 100644 pyvips/gobject.pyi create mode 100644 pyvips/gvalue.pyi create mode 100644 pyvips/vconnection.pyi create mode 100644 pyvips/vimage.pyi create mode 100644 pyvips/vinterpolate.pyi create mode 100644 pyvips/vobject.pyi create mode 100644 pyvips/voperation.pyi create mode 100644 pyvips/vregion.pyi create mode 100644 pyvips/vsource.pyi create mode 100644 pyvips/vsourcecustom.pyi create mode 100644 pyvips/vtarget.pyi create mode 100644 pyvips/vtargetcustom.pyi diff --git a/examples/generate_type_stubs.py b/examples/generate_type_stubs.py index 836e3ce..e94952c 100755 --- a/examples/generate_type_stubs.py +++ b/examples/generate_type_stubs.py @@ -196,7 +196,7 @@ def generate_enums() -> str: ) enum_defs.append(enum_def) - return "\n\n".join(enum_defs) + return "\n\n".join(enum_defs) + "\n" def generate_stub() -> str: @@ -205,32 +205,98 @@ def generate_stub() -> str: 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"""import logging +from collections.abc import Mapping +from typing import Any, Callable + +from .base import leak_set as leak_set, shutdown as shutdown, version as version, get_suffixes as get_suffixes, at_least_libvips as at_least_libvips, type_find as type_find, type_name as type_name, nickname_find as nickname_find, type_from_name as type_from_name, type_map as type_map, values_for_enum as values_for_enum, values_for_flag as values_for_flag, enum_dict as enum_dict, flags_dict as flags_dict +from .enums import {enums} +from .error import Error as Error, _to_bytes as _to_bytes, _to_string as _to_string, _to_string_copy as _to_string_copy +from .gobject import GObject as GObject +from .gvalue import GValue as GValue +from .vconnection import Connection as Connection +from .vimage import Image as Image +from .vinterpolate import Interpolate as Interpolate +from .vobject import VipsObject as VipsObject +from .voperation import Introspect as Introspect, Operation as Operation, cache_set_max as cache_set_max, cache_set_max_mem as cache_set_max_mem, cache_set_max_files as cache_set_max_files, cache_set_trace as cache_set_trace, cache_get_max as cache_get_max, cache_get_size as cache_get_size, cache_get_max_mem as cache_get_max_mem, cache_get_max_files as cache_get_max_files, block_untrusted_set as block_untrusted_set, operation_block_set as operation_block_set +from .vregion import Region as Region +from .vsource import Source as Source +from .vsourcecustom import SourceCustom as SourceCustom +from .vtarget import Target as Target +from .vtargetcustom import TargetCustom as TargetCustom + +_MetadataValue = bool | int | float | str | Image | list[int] | list[float] | list[Image] +_MetadataDict = dict[str, _MetadataValue] + +logger: logging.Logger + +API_mode: bool + +__version__: str + +ffi: Any +glib_lib: Any +vips_lib: Any +gobject_lib: Any + +_log_handler_id: int | None +_remove_handler: Callable[[bytes, int], Any] + +def library_name(name: str, abi_number: int, lib_prefix: str = "lib") -> str: ... +def _log_handler_callback( + domain: Any, level: int, message: Any, user_data: Any +) -> None: ... +def _remove_log_handler() -> None: ... + +def call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, _MetadataDict]: ... + +class GLogLevelFlags: + FLAG_RECURSION: int + FLAG_FATAL: int + + LEVEL_ERROR: int + LEVEL_CRITICAL: int + LEVEL_WARNING: int + LEVEL_MESSAGE: int + LEVEL_INFO: int + LEVEL_DEBUG: int + + LEVEL_TO_LOGGER: Mapping[int, int] +""" + + return stub + + +def generate_vimage() -> str: + """Generate the ``vimage.py`` stub.""" + + 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. # flake8: noqa: E501 This file is automatically generated by examples/generate_type_stubs.py. -RATIONALE FOR GENERATION: -- pyvips is a binding around libvips C library -- libvips has 300+ operations that change frequently -- Manual stub maintenance would be unmaintainable -- Generation uses same introspection as docs/ enums -- Ensures stubs stay synchronized with available operations - To regenerate after libvips updates: python examples/generate_type_stubs.py """ from pathlib import Path from types import TracebackType -from typing import Any, Callable, Protocol, TypeAlias +from typing import Any, Protocol, TypeAlias import numpy as np # type: ignore[import-not-found] from PIL.Image import Image as PILImage # type: ignore from .enums import {enums} +from .error import Error as Error +from .vinterpolate import Interpolate +from .vobject import VipsObject +from .vsource import Source +from .vtarget import Target class _ArrayInterface(Protocol): @property @@ -254,95 +320,6 @@ def __array__(self, dtype: np.dtype | None = None, copy: bool | None = None) -> _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(object): - def signal_connect(self, name: str, callback: Any) -> None: ... - -class VipsObject(GObject): ... - -class GValue(object): - gbool_type: int - gint_type: int - guint64_type: int - gdouble_type: int - gstr_type: int - genum_type: int - gflags_type: int - gobject_type: int - image_type: int - array_int_type: int - array_double_type: int - array_image_type: int - refstr_type: int - blob_type: int - source_type: int - 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 Connection(VipsObject): ... - -class Source(Connection): - @staticmethod - def new_from_descriptor(descriptor: int) -> Source: ... - -class SourceCustom(Source): - 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: ... - - @staticmethod - def new_to_memory() -> Target: ... - -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.""" @@ -513,76 +490,6 @@ 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] - - 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: ... -def cache_set_trace(trace: bool) -> None: ... -def cache_get_max() -> int: ... -def cache_get_size() -> int: ... -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 call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, _MetadataDict]: ... - -# Module-level constants -API_mode: bool ''' return stub @@ -600,3 +507,8 @@ def call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, stub_file = stub_base / "enums.pyi" stub_file.write_text(generate_enums()) print(f"Generated type stub at {stub_file}") + + # Write to pyvips/vimage.pyi + stub_file = stub_base / "vimage.pyi" + stub_file.write_text(generate_vimage()) + print(f"Generated type stub at {stub_file}") diff --git a/pyvips/__init__.pyi b/pyvips/__init__.pyi index 837dd2e..12b24c2 100644 --- a/pyvips/__init__.pyi +++ b/pyvips/__init__.pyi @@ -1,800 +1,57 @@ -"""Type stubs for pyvips. - -# flake8: noqa: E501 - -This file is automatically generated by examples/generate_type_stubs.py. - -RATIONALE FOR GENERATION: -- pyvips is a binding around libvips C library -- libvips has 300+ operations that change frequently -- Manual stub maintenance would be unmaintainable -- Generation uses same introspection as docs/ enums -- Ensures stubs stay synchronized with available operations - -To regenerate after libvips updates: - python examples/generate_type_stubs.py -""" - -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 PIL.Image import Image as PILImage # type: ignore +import logging +from collections.abc import Mapping +from typing import Any, Callable +from .base import leak_set as leak_set, shutdown as shutdown, version as version, get_suffixes as get_suffixes, at_least_libvips as at_least_libvips, type_find as type_find, type_name as type_name, nickname_find as nickname_find, type_from_name as type_from_name, type_map as type_map, values_for_enum as values_for_enum, values_for_flag as values_for_flag, enum_dict as enum_dict, flags_dict as flags_dict 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 +from .error import Error as Error, _to_bytes as _to_bytes, _to_string as _to_string, _to_string_copy as _to_string_copy +from .gobject import GObject as GObject +from .gvalue import GValue as GValue +from .vconnection import Connection as Connection +from .vimage import Image as Image +from .vinterpolate import Interpolate as Interpolate +from .vobject import VipsObject as VipsObject +from .voperation import Introspect as Introspect, Operation as Operation, cache_set_max as cache_set_max, cache_set_max_mem as cache_set_max_mem, cache_set_max_files as cache_set_max_files, cache_set_trace as cache_set_trace, cache_get_max as cache_get_max, cache_get_size as cache_get_size, cache_get_max_mem as cache_get_max_mem, cache_get_max_files as cache_get_max_files, block_untrusted_set as block_untrusted_set, operation_block_set as operation_block_set +from .vregion import Region as Region +from .vsource import Source as Source +from .vsourcecustom import SourceCustom as SourceCustom +from .vtarget import Target as Target +from .vtargetcustom import TargetCustom as TargetCustom + +_MetadataValue = bool | int | float | str | Image | list[int] | list[float] | list[Image] +_MetadataDict = dict[str, _MetadataValue] -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" +logger: logging.Logger -_MetadataValue = bool | int | float | str | _ImageAlias | list[int] | list[float] | list[_ImageAlias] -_MetadataDict = dict[str, _MetadataValue] +API_mode: bool -_BufferLike = bytes | bytearray | memoryview -_ImageOperand = _ImageAlias | _NumberLike | _NumberLikeList +__version__: str -# Low-level handles and helpers ffi: Any glib_lib: Any vips_lib: Any gobject_lib: Any +_log_handler_id: int | None +_remove_handler: Callable[[bytes, int], Any] -# Exception classes -class Error(Exception): ... - -# GObject base classes -class GObject(object): - def signal_connect(self, name: str, callback: Any) -> None: ... - -class VipsObject(GObject): ... - -class GValue(object): - gbool_type: int - gint_type: int - guint64_type: int - gdouble_type: int - gstr_type: int - genum_type: int - gflags_type: int - gobject_type: int - image_type: int - array_int_type: int - array_double_type: int - array_image_type: int - refstr_type: int - blob_type: int - source_type: int - 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 Connection(VipsObject): ... - -class Source(Connection): - @staticmethod - def new_from_descriptor(descriptor: int) -> Source: ... - -class SourceCustom(Source): - def on_read(self, handler: Any) -> None: ... - def on_seek(self, handler: Any) -> None: ... +def library_name(name: str, abi_number: int, lib_prefix: str = "lib") -> str: ... +def _log_handler_callback( + domain: Any, level: int, message: Any, user_data: Any +) -> None: ... +def _remove_log_handler() -> None: ... -class Target(Connection): - @staticmethod - def new_to_descriptor(descriptor: int) -> Target: ... - - @staticmethod - def new_to_memory() -> Target: ... - -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.""" - - # Properties - @property - def width(self) -> int: ... - @property - def height(self) -> int: ... - @property - def bands(self) -> int: ... - @property - def format(self) -> str | BandFormat: ... - @property - def interpretation(self) -> str | Interpretation: ... - @property - def xres(self) -> float: ... - @property - def yres(self) -> float: ... - @property - def xoffset(self) -> int: ... - @property - 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) -> _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 | Path, *, memory: bool = ..., access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... - @staticmethod - def new_from_buffer(data: _BufferLike, options: str, *, access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... - @staticmethod - def new_from_list(array: _NumberLikeList | _NumberLike2DList, scale: float = 1.0, offset: float = 0.0) -> Image: ... - @classmethod - 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: _BufferLike, width: int, height: int, bands: int, format: str | BandFormat) -> Image: ... - @staticmethod - 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: _NumberLike | _NumberLikeList) -> Image: ... - def copy_memory(self) -> Image: ... - - # Writers - 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: ... - - # Utility methods - def invalidate(self) -> None: ... - def set_progress(self, progress: bool) -> None: ... - def set_kill(self, kill: bool) -> None: ... - 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: ... - def pil(self) -> PILImage: ... - - # Hand-written bindings with type hints - def floor(self) -> Image: ... - def ceil(self) -> Image: ... - def rint(self) -> Image: ... - 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: 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: ... - def CMYK2XYZ(self) -> Image: ... - def HSV2sRGB(self) -> Image: ... - def LCh2CMC(self) -> Image: ... - def LCh2Lab(self) -> Image: ... - def Lab2LCh(self) -> Image: ... - def Lab2LabQ(self) -> Image: ... - def Lab2LabS(self) -> 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 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: 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 | 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: 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: 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: ... - @staticmethod - 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: str | Precision = ...) -> Image: ... - def case(self, cases: list[Image]) -> 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: 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: 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 | 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: 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 = ...) -> 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_smudge(self, left: int, top: int, width: int, height: int) -> 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: ... - @staticmethod - 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 = ...) -> Image: ... - def find_trim(self, *, threshold: float = ..., background: list[float] = ..., line_art: bool = ...) -> tuple[int, int, int, int]: ... - @staticmethod - 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: 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: str | Precision = ...) -> Image: ... - @staticmethod - 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]: ... - @staticmethod - 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: _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: 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 grid(self, tile_height: int, across: int, down: int) -> Image: ... - @staticmethod - 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: _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: 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: 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_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: 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: 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_buffer(buffer: _BufferLike, *, page: int = ..., oneshot: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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 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_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_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 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_buffer(buffer: _BufferLike, *, page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - def jxlload_source(source: Source, *, page: int = ..., n: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - def jxlsave(self, filename: str | Path, *, tier: int = ..., distance: float = ..., effort: int = ..., lossless: bool = ..., Q: int = ..., bitdepth: int = ..., 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 logmat(sigma: float, min_ampl: float, *, separable: bool = ..., precision: str | Precision = ...) -> Image: ... - @staticmethod - 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_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_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: ... - @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: ... - @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: ... - @staticmethod - 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: ... - @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: ... - @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: ... - @staticmethod - 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: ... - @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: 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 | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - def matrixinvert(self) -> Image: ... - @staticmethod - 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: 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: 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: 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 niftiload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - def niftiload_source(source: Source, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - def niftisave(self, filename: str | Path, *, keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... - @staticmethod - def openexrload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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: _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 = ..., 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 phasecor(self, in2: Image) -> Image: ... - @staticmethod - 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: _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: 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 | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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) -> bytes: ... - def project(self) -> tuple[Image, Image]: ... - def quadratic(self, coeff: Image, *, interpolate: Interpolate = ...) -> Image: ... - def rad2float(self) -> Image: ... - @staticmethod - def radload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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: 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 | 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: 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: 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 scRGB2XYZ(self) -> Image: ... - def scRGB2sRGB(self, *, depth: int = ...) -> Image: ... - def scharr(self) -> Image: ... - @staticmethod - 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: Interpolate = ..., background: list[float] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ...) -> Image: ... - @staticmethod - def sines(width: int, height: int, *, uchar: bool = ..., hfreq: float = ..., vfreq: float = ...) -> Image: ... - def smartcrop(self, width: int, height: int, *, interesting: str | Interesting = ..., 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 subtract(self, right: Image) -> Image: ... - @staticmethod - def sum(in_: list[Image]) -> Image: ... - @staticmethod - 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: _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 = ..., 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] = ..., 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 thumbnail_buffer(buffer: _BufferLike, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... - def thumbnail_image(self, width: int, *, height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... - @staticmethod - def thumbnail_source(source: Source, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... - @staticmethod - def tiffload(filename: str | Path, *, page: int = ..., n: int = ..., autorotate: bool = ..., subifd: int = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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_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 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 uhdrload(filename: str | Path, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - def uhdrload_buffer(buffer: _BufferLike, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - def uhdrload_source(source: Source, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - def uhdrsave(self, filename: str | Path, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... - def uhdrsave_buffer(self, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... - def uhdrsave_target(self, target: Target, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... - def unpremultiply(self, *, max_alpha: float = ..., alpha_band: int = ...) -> Image: ... - @staticmethod - def vipsload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... - @staticmethod - 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(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_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 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 worley(width: int, height: int, *, cell_size: int = ..., seed: int = ...) -> Image: ... - def wrap(self, *, x: int = ..., y: int = ...) -> Image: ... - @staticmethod - 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: ... - - # 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: ... - # 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] - - 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]: ... +def call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, _MetadataDict]: ... -# 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: ... -def cache_set_trace(trace: bool) -> None: ... -def cache_get_max() -> int: ... -def cache_get_size() -> int: ... -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: ... +class GLogLevelFlags: + FLAG_RECURSION: int + FLAG_FATAL: int -def call(operation_name: str, *args: Any, **kwargs: Any) -> Image | tuple[Image, _MetadataDict]: ... + LEVEL_ERROR: int + LEVEL_CRITICAL: int + LEVEL_WARNING: int + LEVEL_MESSAGE: int + LEVEL_INFO: int + LEVEL_DEBUG: int -# Module-level constants -API_mode: bool + LEVEL_TO_LOGGER: Mapping[int, int] diff --git a/pyvips/base.pyi b/pyvips/base.pyi new file mode 100644 index 0000000..168dc0c --- /dev/null +++ b/pyvips/base.pyi @@ -0,0 +1,16 @@ +from collections.abc import Callable + +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]: ... diff --git a/pyvips/enums.pyi b/pyvips/enums.pyi index d030624..9bee5dd 100644 --- a/pyvips/enums.pyi +++ b/pyvips/enums.pyi @@ -345,4 +345,4 @@ class TextWrap: WORD: str = 'word' CHAR: str = 'char' WORD_CHAR: str = 'word-char' - NONE: str = 'none' \ No newline at end of file + NONE: str = 'none' diff --git a/pyvips/error.pyi b/pyvips/error.pyi new file mode 100644 index 0000000..0a54688 --- /dev/null +++ b/pyvips/error.pyi @@ -0,0 +1,16 @@ +import logging +from pathlib import Path +from typing import Any + +logger: logging.Logger + +def _to_bytes(x: str | Path | bytes | Any) -> bytes: ... +def _to_string(x: Any) -> str: ... +def _to_string_copy(x: Any) -> str: ... + +class Error(Exception): + message: str + detail: str + + def __init__(self, message: str, detail: str | None = None) -> None: ... + def __str__(self) -> str: ... diff --git a/pyvips/gobject.pyi b/pyvips/gobject.pyi new file mode 100644 index 0000000..75f6c96 --- /dev/null +++ b/pyvips/gobject.pyi @@ -0,0 +1,14 @@ +import logging +from collections.abc import Callable +from typing import Any + +logger: logging.Logger + +class GObject(object): + _handles: list[Any] + pointer: Any + + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def new_pointer_from_gtype(gtype: int) -> Any: ... + def signal_connect(self, name: str, callback: Callable[..., Any]) -> None: ... diff --git a/pyvips/gvalue.pyi b/pyvips/gvalue.pyi new file mode 100644 index 0000000..8a9bb61 --- /dev/null +++ b/pyvips/gvalue.pyi @@ -0,0 +1,46 @@ +import logging +from typing import Any, ClassVar + +from pyvips import Image + +_MetadataValue = bool | int | float | str | Image | list[int] | list[float] | list[Image] + +logger: logging.Logger + +class GValue(object): + gbool_type: ClassVar[int] + gint_type: ClassVar[int] + guint64_type: ClassVar[int] + gdouble_type: ClassVar[int] + gstr_type: ClassVar[int] + genum_type: ClassVar[int] + gflags_type: ClassVar[int] + gobject_type: ClassVar[int] + image_type: ClassVar[int] + array_int_type: ClassVar[int] + array_double_type: ClassVar[int] + array_image_type: ClassVar[int] + refstr_type: ClassVar[int] + blob_type: ClassVar[int] + source_type: ClassVar[int] + target_type: ClassVar[int] + format_type: ClassVar[int] + blend_mode_type: ClassVar[int] + + _gtype_to_python: ClassVar[dict[int, str]] + + 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: ... diff --git a/pyvips/vconnection.pyi b/pyvips/vconnection.pyi new file mode 100644 index 0000000..5b31b2b --- /dev/null +++ b/pyvips/vconnection.pyi @@ -0,0 +1,11 @@ +import logging +from typing import Any + +from pyvips.vobject import VipsObject + +logger: logging.Logger + +class Connection(VipsObject): + def __init__(self, pointer: Any) -> None: ... + def filename(self) -> str | None: ... + def nick(self) -> str | None: ... diff --git a/pyvips/vimage.pyi b/pyvips/vimage.pyi new file mode 100644 index 0000000..73935b7 --- /dev/null +++ b/pyvips/vimage.pyi @@ -0,0 +1,562 @@ +"""Type stubs for pyvips. + +# flake8: noqa: E501 + +This file is automatically generated by examples/generate_type_stubs.py. + +To regenerate after libvips updates: + python examples/generate_type_stubs.py +""" + +from pathlib import Path +from types import TracebackType +from typing import Any, Protocol, TypeAlias + +import numpy as np # type: ignore[import-not-found] + +from PIL.Image import Image as PILImage # type: ignore + +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 +from .error import Error as Error +from .vinterpolate import Interpolate +from .vobject import VipsObject +from .vsource import Source +from .vtarget import Target + +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 + +class Image(VipsObject): + """Wrap a VipsImage object.""" + + # Properties + @property + def width(self) -> int: ... + @property + def height(self) -> int: ... + @property + def bands(self) -> int: ... + @property + def format(self) -> str | BandFormat: ... + @property + def interpretation(self) -> str | Interpretation: ... + @property + def xres(self) -> float: ... + @property + def yres(self) -> float: ... + @property + def xoffset(self) -> int: ... + @property + 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) -> _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 | Path, *, memory: bool = ..., access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... + @staticmethod + def new_from_buffer(data: _BufferLike, options: str, *, access: Access | str = ..., fail: bool = ..., **kwargs: Any) -> Image: ... + @staticmethod + def new_from_list(array: _NumberLikeList | _NumberLike2DList, scale: float = 1.0, offset: float = 0.0) -> Image: ... + @classmethod + 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: _BufferLike, width: int, height: int, bands: int, format: str | BandFormat) -> Image: ... + @staticmethod + 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: _NumberLike | _NumberLikeList) -> Image: ... + def copy_memory(self) -> Image: ... + + # Writers + 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: ... + + # Utility methods + def invalidate(self) -> None: ... + def set_progress(self, progress: bool) -> None: ... + def set_kill(self, kill: bool) -> None: ... + 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: ... + def pil(self) -> PILImage: ... + + # Hand-written bindings with type hints + def floor(self) -> Image: ... + def ceil(self) -> Image: ... + def rint(self) -> Image: ... + 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: 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: ... + def CMYK2XYZ(self) -> Image: ... + def HSV2sRGB(self) -> Image: ... + def LCh2CMC(self) -> Image: ... + def LCh2Lab(self) -> Image: ... + def Lab2LCh(self) -> Image: ... + def Lab2LabQ(self) -> Image: ... + def Lab2LabS(self) -> 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 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: Interpolate = ..., oarea: list[int] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ..., background: list[float] = ..., premultiplied: bool = ..., extend: str | Extend = ...) -> Image: ... + @staticmethod + 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: 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: ... + @staticmethod + 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: str | Precision = ...) -> Image: ... + def case(self, cases: list[Image]) -> 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: 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: 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 | 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: 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: ... + 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 = ...) -> 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_smudge(self, left: int, top: int, width: int, height: int) -> 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: ... + @staticmethod + 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 = ...) -> Image: ... + def find_trim(self, *, threshold: float = ..., background: list[float] = ..., line_art: bool = ...) -> tuple[int, int, int, int]: ... + 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 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: 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]: ... + @staticmethod + 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: _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: 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 grid(self, tile_height: int, across: int, down: int) -> Image: ... + @staticmethod + 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: _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: 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: 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_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: 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 join(self, in2: Image, direction: str | Direction, *, expand: bool = ..., shim: int = ..., background: list[float] = ..., align: str | Align = ...) -> Image: ... + @staticmethod + 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_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_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: ... + 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 logmat(sigma: float, min_ampl: float, *, separable: bool = ..., precision: str | Precision = ...) -> Image: ... + 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: ... + @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: ... + @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: ... + @staticmethod + 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: ... + @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: ... + @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: ... + @staticmethod + 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: ... + @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: 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: ... + def matrixinvert(self) -> Image: ... + @staticmethod + 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: 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: 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: 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: ... + def percent(self, percent: float) -> int: ... + @staticmethod + 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 | Path, *, unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + 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: 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: ... + def premultiply(self, *, max_alpha: float = ...) -> Image: ... + def prewitt(self) -> Image: ... + def profile(self) -> tuple[Image, Image]: ... + @staticmethod + def profile_load(name: str) -> bytes: ... + def project(self) -> tuple[Image, Image]: ... + def quadratic(self, coeff: Image, *, interpolate: Interpolate = ...) -> Image: ... + def rad2float(self) -> Image: ... + def rank(self, width: int, height: int, index: int) -> Image: ... + @staticmethod + 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: 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: 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 scRGB2XYZ(self) -> Image: ... + def scRGB2sRGB(self, *, depth: int = ...) -> Image: ... + def scharr(self) -> Image: ... + @staticmethod + 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: Interpolate = ..., background: list[float] = ..., odx: float = ..., ody: float = ..., idx: float = ..., idy: float = ...) -> Image: ... + @staticmethod + def sines(width: int, height: int, *, uchar: bool = ..., hfreq: float = ..., vfreq: float = ...) -> Image: ... + def smartcrop(self, width: int, height: int, *, interesting: str | Interesting = ..., 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 subtract(self, right: Image) -> Image: ... + @staticmethod + def sum(in_: list[Image]) -> Image: ... + @staticmethod + 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: _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 = ..., 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] = ..., 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 thumbnail_buffer(buffer: _BufferLike, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + def thumbnail_image(self, width: int, *, height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + @staticmethod + def thumbnail_source(source: Source, width: int, *, option_string: str = ..., height: int = ..., size: str | Size = ..., no_rotate: bool = ..., crop: str | Interesting = ..., linear: bool = ..., input_profile: str | Path = ..., output_profile: str | Path = ..., intent: str | Intent = ..., fail_on: str | FailOn = ...) -> Image: ... + @staticmethod + def tiffload(filename: str | Path, *, page: int = ..., n: int = ..., autorotate: bool = ..., subifd: int = ..., unlimited: bool = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + 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_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 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 uhdrload(filename: str | Path, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + def uhdrload_buffer(buffer: _BufferLike, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + def uhdrload_source(source: Source, *, shrink: int = ..., memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + def uhdrsave(self, filename: str | Path, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def uhdrsave_buffer(self, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> bytes: ... + def uhdrsave_target(self, target: Target, *, Q: int = ..., gainmap_scale_factor: int = ..., keep: int = ..., background: list[float] = ..., page_height: int = ..., profile: str | Path = ...) -> None: ... + def unpremultiply(self, *, max_alpha: float = ..., alpha_band: int = ...) -> Image: ... + @staticmethod + def vipsload(filename: str | Path, *, memory: bool = ..., access: str | Access = ..., fail_on: str | FailOn = ..., revalidate: bool = ..., flags: bool = ...) -> Image: ... + @staticmethod + 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(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_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 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 worley(width: int, height: int, *, cell_size: int = ..., seed: int = ...) -> Image: ... + def wrap(self, *, x: int = ..., y: int = ...) -> Image: ... + @staticmethod + 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: ... + + # 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: ... + # 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: ... diff --git a/pyvips/vinterpolate.pyi b/pyvips/vinterpolate.pyi new file mode 100644 index 0000000..a2f6881 --- /dev/null +++ b/pyvips/vinterpolate.pyi @@ -0,0 +1,8 @@ +from typing import Any + +from pyvips.vobject import VipsObject + +class Interpolate(VipsObject): + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def new(name: str) -> "Interpolate": ... diff --git a/pyvips/vobject.pyi b/pyvips/vobject.pyi new file mode 100644 index 0000000..7f86620 --- /dev/null +++ b/pyvips/vobject.pyi @@ -0,0 +1,22 @@ +import logging +from typing import Any, ClassVar + +from pyvips.gobject import GObject + +logger: logging.Logger + +class VipsObject(GObject): + vobject: Any + gobject: Any + _pspec_cache: ClassVar[dict[Any, dict[str, Any]]] + + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def print_all() -> None: ... + def _get_pspec(self, name: str) -> Any | None: ... + def get_typeof(self, name: str) -> int: ... + def get_blurb(self, name: str) -> str: ... + def get(self, name: str) -> Any: ... + def set(self, name: str, value: Any) -> None: ... + def set_string(self, string_options: str) -> bool: ... + def get_description(self) -> str: ... diff --git a/pyvips/voperation.pyi b/pyvips/voperation.pyi new file mode 100644 index 0000000..a55ec46 --- /dev/null +++ b/pyvips/voperation.pyi @@ -0,0 +1,75 @@ +import logging +from typing import Any, Callable, ClassVar + +from pyvips.vimage import Image +from pyvips.vobject import VipsObject + +logger: logging.Logger + +_REQUIRED: int +_CONSTRUCT: int +_SET_ONCE: int +_SET_ALWAYS: int +_INPUT: int +_OUTPUT: int +_DEPRECATED: int +_MODIFY: int + +_OPERATION_NOCACHE: int +_OPERATION_DEPRECATED: int + +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] + doc_optional_input: list[str] + doc_optional_output: list[str] + member_x: str | None + method_args: list[str] + + _introspect_cache: ClassVar[dict[str, Introspect]] + + def __init__(self, operation_name: str) -> None: ... + @classmethod + def get(cls: type["Introspect"], operation_name: str) -> "Introspect": ... + +def _find_inside(pred: Callable[[Any], bool], thing: Any) -> Any | None: ... + +class Operation(VipsObject): + _docstring_cache: ClassVar[dict[str, str]] + + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def new_from_name(operation_name: str) -> "Operation": ... + def set( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride, reportImplicitOverride] + 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 _argtype_to_python(name: str, type: Any) -> str: ... + @staticmethod + def generate_docstring(operation_name: str) -> str: ... + @staticmethod + def generate_sphinx(operation_name: str) -> str: ... + @staticmethod + def generate_sphinx_all() -> None: ... + +def cache_set_max(mx: int) -> None: ... +def cache_set_max_mem(mx: int) -> None: ... +def cache_set_max_files(mx: int) -> None: ... +def cache_set_trace(trace: bool) -> None: ... +def cache_get_max() -> int: ... +def cache_get_size() -> int: ... +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: ... diff --git a/pyvips/vregion.pyi b/pyvips/vregion.pyi new file mode 100644 index 0000000..fcd377a --- /dev/null +++ b/pyvips/vregion.pyi @@ -0,0 +1,12 @@ +from typing import Any + +from pyvips.vimage import Image +from pyvips.vobject import VipsObject + +class Region(VipsObject): + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def new(image: Image) -> Region: ... + def width(self) -> int: ... + def height(self) -> int: ... + def fetch(self, x: int, y: int, w: int, h: int) -> memoryview: ... diff --git a/pyvips/vsource.pyi b/pyvips/vsource.pyi new file mode 100644 index 0000000..9340982 --- /dev/null +++ b/pyvips/vsource.pyi @@ -0,0 +1,18 @@ +import logging +from collections.abc import Buffer +from typing import Any + +from .vconnection import Connection + +logger: logging.Logger + +class Source(Connection): + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def new_from_descriptor(descriptor: int) -> "Source": ... + @staticmethod + def new_from_file(filename: str) -> "Source": ... + @staticmethod + def new_from_memory(data: Buffer | memoryview | bytes | bytearray) -> "Source": ... + + _references: list[Any] diff --git a/pyvips/vsourcecustom.pyi b/pyvips/vsourcecustom.pyi new file mode 100644 index 0000000..c4fe9df --- /dev/null +++ b/pyvips/vsourcecustom.pyi @@ -0,0 +1,11 @@ +import logging +from collections.abc import Callable + +from pyvips.vsource import Source + +logger: logging.Logger + +class SourceCustom(Source): + def __init__(self) -> None: ... + def on_read(self, handler: Callable[[int], bytes | None]) -> None: ... + def on_seek(self, handler: Callable[[int, int], int]) -> None: ... diff --git a/pyvips/vtarget.pyi b/pyvips/vtarget.pyi new file mode 100644 index 0000000..ddf5da2 --- /dev/null +++ b/pyvips/vtarget.pyi @@ -0,0 +1,15 @@ +import logging +from typing import Any + +from pyvips.vconnection import Connection + +logger: logging.Logger + +class Target(Connection): + def __init__(self, pointer: Any) -> None: ... + @staticmethod + def new_to_descriptor(descriptor: int) -> "Target": ... + @staticmethod + def new_to_file(filename: str) -> "Target": ... + @staticmethod + def new_to_memory() -> "Target": ... diff --git a/pyvips/vtargetcustom.pyi b/pyvips/vtargetcustom.pyi new file mode 100644 index 0000000..fcc71d2 --- /dev/null +++ b/pyvips/vtargetcustom.pyi @@ -0,0 +1,16 @@ +import logging +from typing import Callable + +from pyvips.vtarget import Target + +logger: logging.Logger + +_BufferLike = bytes | bytearray | memoryview + +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: ... From 199311dbecfeea6598cb01e418b8b6a7f3fa8a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kurt=20B=C3=B6hm?= Date: Thu, 9 Jul 2026 08:01:43 +0200 Subject: [PATCH 2/2] Restrict the type annotations slightly to support Python 3.10 and 3.11 --- pyvips/vsource.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyvips/vsource.pyi b/pyvips/vsource.pyi index 9340982..51a674d 100644 --- a/pyvips/vsource.pyi +++ b/pyvips/vsource.pyi @@ -1,5 +1,4 @@ import logging -from collections.abc import Buffer from typing import Any from .vconnection import Connection @@ -13,6 +12,6 @@ class Source(Connection): @staticmethod def new_from_file(filename: str) -> "Source": ... @staticmethod - def new_from_memory(data: Buffer | memoryview | bytes | bytearray) -> "Source": ... + def new_from_memory(data: bytes | bytearray | memoryview) -> "Source": ... _references: list[Any]