2021-04-13 09:47:52 +02:00
|
|
|
from collections import namedtuple
|
|
|
|
from typing import Any, Optional
|
|
|
|
|
2022-05-05 16:08:16 +02:00
|
|
|
Resolution = namedtuple("Resolution", "x y unit_is_meter")
|
2021-04-13 09:47:52 +02:00
|
|
|
|
|
|
|
class Error(Exception): ...
|
|
|
|
class FormatError(Error): ...
|
|
|
|
class ProtocolError(Error): ...
|
|
|
|
class ChunkError(FormatError): ...
|
|
|
|
class Default: ...
|
|
|
|
|
|
|
|
class Writer:
|
|
|
|
width: Any = ...
|
|
|
|
height: Any = ...
|
|
|
|
transparent: Any = ...
|
|
|
|
background: Any = ...
|
|
|
|
gamma: Any = ...
|
|
|
|
greyscale: Any = ...
|
|
|
|
alpha: Any = ...
|
|
|
|
colormap: Any = ...
|
|
|
|
bitdepth: Any = ...
|
|
|
|
compression: Any = ...
|
|
|
|
chunk_limit: Any = ...
|
|
|
|
interlace: Any = ...
|
|
|
|
palette: Any = ...
|
|
|
|
x_pixels_per_unit: Any = ...
|
|
|
|
y_pixels_per_unit: Any = ...
|
|
|
|
unit_is_meter: Any = ...
|
|
|
|
color_type: Any = ...
|
|
|
|
color_planes: Any = ...
|
|
|
|
planes: Any = ...
|
|
|
|
psize: Any = ...
|
2022-05-05 16:08:16 +02:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
width: Optional[Any] = ...,
|
|
|
|
height: Optional[Any] = ...,
|
|
|
|
size: Optional[Any] = ...,
|
|
|
|
greyscale: Any = ...,
|
|
|
|
alpha: bool = ...,
|
|
|
|
bitdepth: int = ...,
|
|
|
|
palette: Optional[Any] = ...,
|
|
|
|
transparent: Optional[Any] = ...,
|
|
|
|
background: Optional[Any] = ...,
|
|
|
|
gamma: Optional[Any] = ...,
|
|
|
|
compression: Optional[Any] = ...,
|
|
|
|
interlace: bool = ...,
|
|
|
|
planes: Optional[Any] = ...,
|
|
|
|
colormap: Optional[Any] = ...,
|
|
|
|
maxval: Optional[Any] = ...,
|
|
|
|
chunk_limit: Any = ...,
|
|
|
|
x_pixels_per_unit: Optional[Any] = ...,
|
|
|
|
y_pixels_per_unit: Optional[Any] = ...,
|
|
|
|
unit_is_meter: bool = ...,
|
|
|
|
) -> None: ...
|
2021-04-13 09:47:52 +02:00
|
|
|
def write(self, outfile: Any, rows: Any): ...
|
|
|
|
def write_passes(self, outfile: Any, rows: Any): ...
|
|
|
|
def write_packed(self, outfile: Any, rows: Any): ...
|
|
|
|
def write_preamble(self, outfile: Any) -> None: ...
|
|
|
|
def write_array(self, outfile: Any, pixels: Any) -> None: ...
|
|
|
|
def array_scanlines(self, pixels: Any) -> None: ...
|
|
|
|
def array_scanlines_interlace(self, pixels: Any) -> None: ...
|
|
|
|
|
|
|
|
def write_chunks(out: Any, chunks: Any) -> None: ...
|
|
|
|
def from_array(a: Any, mode: Optional[Any] = ..., info: Any = ...): ...
|
2022-05-05 16:08:16 +02:00
|
|
|
|
2021-04-13 09:47:52 +02:00
|
|
|
fromarray = from_array
|
|
|
|
|
|
|
|
class Image:
|
|
|
|
rows: Any = ...
|
|
|
|
info: Any = ...
|
|
|
|
def __init__(self, rows: Any, info: Any) -> None: ...
|
|
|
|
def save(self, file: Any) -> None: ...
|
|
|
|
def write(self, file: Any) -> None: ...
|
|
|
|
|
|
|
|
class Reader:
|
|
|
|
signature: Any = ...
|
|
|
|
transparent: Any = ...
|
|
|
|
atchunk: Any = ...
|
|
|
|
file: Any = ...
|
2022-05-05 16:08:16 +02:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
_guess: Optional[Any] = ...,
|
|
|
|
filename: Optional[Any] = ...,
|
|
|
|
file: Optional[Any] = ...,
|
|
|
|
bytes: Optional[Any] = ...,
|
|
|
|
) -> None: ...
|
2021-04-13 09:47:52 +02:00
|
|
|
def chunk(self, lenient: bool = ...): ...
|
|
|
|
def chunks(self) -> None: ...
|
|
|
|
def undo_filter(self, filter_type: Any, scanline: Any, previous: Any): ...
|
|
|
|
def validate_signature(self) -> None: ...
|
|
|
|
def preamble(self, lenient: bool = ...) -> None: ...
|
|
|
|
def process_chunk(self, lenient: bool = ...) -> None: ...
|
|
|
|
def read(self, lenient: bool = ...): ...
|
|
|
|
def read_flat(self): ...
|
|
|
|
def palette(self, alpha: str = ...): ...
|
|
|
|
def asDirect(self): ...
|
|
|
|
def asRGB8(self): ...
|
|
|
|
def asRGBA8(self): ...
|
|
|
|
def asRGB(self): ...
|
|
|
|
def asRGBA(self): ...
|