Skip to content

rs_rich.art

Generated from the type stubs by scripts/gen_python_api.py; do not edit.

rs_rich.art: the rich-art crate (no Rich counterpart).

Images in every mode (ASCII, half-blocks, Braille, quadrants, Sixel), fit, anchor, background, colour mode, dither and adjustment; FIGlet banners; animated GIFs; and perceptual image diffs. Everything renders in Rust. Submodules mirror the crate's modules: image_art, ascii, block, braille, quadrant, sixel, figlet, gif, stage and imagediff.

DEFAULT_RAMP module-attribute

DEFAULT_RAMP: str

SIXEL_DEFAULT_CELL_PX module-attribute

SIXEL_DEFAULT_CELL_PX: Tuple[int, int]

SIXEL_MAX_PIXELS module-attribute

SIXEL_MAX_PIXELS: int

STANDARD_FONT module-attribute

STANDARD_FONT: str

diff module-attribute

diff = image_diff

AnimatedArt

MAX_DECODED_BYTES instance-attribute

MAX_DECODED_BYTES: int

frame_count property

frame_count: int

duration property

duration: float

repeat property

repeat: Union[int, Literal['forever']]

color property

color: bool

blocks property

blocks: bool

color_mode property

color_mode: str

dither property

dither: Optional[str]

color_distance property

color_distance: str

frame_delay

frame_delay(index: int) -> Optional[float]

frame

frame(index: int) -> Optional[AsciiArt]

render_frame

render_frame(index: int) -> Optional[GifFrame]

frames

frames() -> List[Tuple[GifFrame, float]]

play

play(console: Optional[Console] = None) -> None

ArtError

Bases: Exception

The base of the art errors.

ArtImage

width property

width: int

height property

height: int

size property

size: Tuple[int, int]

mode property

mode: str

open staticmethod

open(path: Any) -> ArtImage

from_bytes staticmethod

from_bytes(data: Union[bytes, bytearray, memoryview]) -> ArtImage

from_pil staticmethod

from_pil(image: Any) -> ArtImage

frombytes staticmethod

frombytes(mode: Literal['RGBA', 'RGB', 'LA', 'L'], size: Tuple[int, int], data: Union[bytes, bytearray, memoryview]) -> ArtImage

tobytes

tobytes() -> bytes

to_rgba

to_rgba() -> bytes

to_png

to_png() -> bytes

save

save(path: Any) -> None

to_pil

to_pil() -> Any

AsciiArt

columns

columns(available: int) -> int

to_text

to_text(width: int) -> str

BlockArt

BrailleArt

to_text

to_text(width: int) -> str

DiffRegion

x instance-attribute

x: int

y instance-attribute

y: int

width instance-attribute

width: int

height instance-attribute

height: int

area_px instance-attribute

area_px: int

share_of_change instance-attribute

share_of_change: float

mean_delta_e instance-attribute

mean_delta_e: float

DiffReport

width property

width: int

height property

height: int

changed_fraction property

changed_fraction: float

naive_changed_fraction property

naive_changed_fraction: float

mean_delta_e property

mean_delta_e: float

max_delta_e property

max_delta_e: float

regions property

regions: List[DiffRegion]

delta_e property

delta_e: List[float]

heatmap

heatmap() -> ArtImage

highlight

highlight(after: Any) -> ArtImage

DiffSettings

blur instance-attribute

blur: float

threshold instance-attribute

threshold: float

open_kernel instance-attribute

open_kernel: int

min_region instance-attribute

min_region: int

top instance-attribute

top: int

Figlet

text property

text: str

font property

font: FigletFont

justify property

justify: str

width property

width: Optional[int]

to_text

to_text(width: Optional[int] = None) -> str

FigletFont

height property

height: int

hard_blank property

hard_blank: str

parse staticmethod

parse(source: str) -> FigletFont

standard staticmethod

standard() -> FigletFont

from_path staticmethod

from_path(path: Any) -> FigletFont

FigletFontError

Bases: ArtError

A FIGfont could not be parsed.

GifFrame

index property

index: int

ImageArt

image property

image: ArtImage

options property

options: ImageOptions

mode property

mode: str

width property

width: Optional[int]

height property

height: Optional[int]

color property

color: bool

fit property

fit: Optional[str]

anchor property

anchor: str

background property

background: Union[None, str, Tuple[int, int, int]]

color_mode property

color_mode: str

dither property

dither: Optional[str]

color_distance property

color_distance: str

rotate property

rotate: int

flip_horizontal property

flip_horizontal: bool

flip_vertical property

flip_vertical: bool

grayscale property

grayscale: bool

brightness property

brightness: float

contrast property

contrast: float

gamma property

gamma: float

max_width property

max_width: Optional[int]

max_height property

max_height: Optional[int]

resolve_mode

resolve_mode(capabilities: RenderCapabilities) -> str

native_grid

native_grid(mode: str, available: int) -> Tuple[int, int]

ImageArtError

Bases: ArtError

An image cannot be rendered as asked; kind says why.

kind instance-attribute

kind: str

ImageDecodeError

Bases: ArtError

Image bytes could not be decoded.

ImageDiffError

Bases: ArtError

Two images cannot be compared; kind says why.

kind instance-attribute

kind: str

ImageOptions

mode property

mode: str

width property

width: Optional[int]

height property

height: Optional[int]

color property

color: bool

QuadrantArt

RenderCapabilities

color instance-attribute

color: bool

sixel_supported instance-attribute

sixel_supported: bool

from_console staticmethod

from_console(console: Console) -> RenderCapabilities

SixelArt

encode

encode(available: int) -> Optional[str]

Stage

gap instance-attribute

gap: int

until instance-attribute

until: Optional[float]

add

add(art: AnimatedArt) -> Stage

play

play(console: Optional[Console] = None) -> None

figlet_render

figlet_render(text: str, font: Optional[FigletFont] = None, width: int = 80, justify: Literal['left', 'center', 'right'] = 'left') -> str

image_diff

image_diff(before: Any, after: Any, settings: Optional[DiffSettings] = None, *, blur: Optional[float] = None, threshold: Optional[float] = None, open_kernel: Optional[int] = None, min_region: Optional[int] = None, top: Optional[int] = None) -> DiffReport

show_cursor_sequence

show_cursor_sequence() -> str

sixel_is_probably_supported

sixel_is_probably_supported() -> bool