sketchkit.stylization package

Subpackages

Submodules

sketchkit.stylization.stylizer module

Stylizer - Unified Interface for Sketch Stylization

This module provides a unified API for stylizing sketches using various methods.

class sketchkit.stylization.stylizer.Stylizer(method: str = 'brushstrokesengine', **kwargs: Any)[source]

Bases: object

A unified wrapper class for stylizing sketches using various methods.

This class provides a consistent API across different stylization methods, allowing users to switch between methods easily.

method

The stylization method being used.

Type:

str

_stylizer

The underlying method-specific stylizer instance.

property model_name: str | None

Get the model name (if supported by the method).

run(sketch: Sketch, output_path: str | None = None, **kwargs: Any) Image[source]

Stylize a sketch using the selected method.

Parameters:
  • sketch – Input vector sketch.

  • output_path – Output file path. If None, uses a temporary path.

  • **kwargs – Method-specific parameters (passed to the underlying method).

Returns:

Stylized image as PIL Image.

Example

>>> stylizer = Stylizer(method="brushstrokesengine")
>>> stylized_image = stylizer.run(sketch, output_path="output.png")
run_from_png(png_path: str | Path, output_path: str | None = None, **kwargs: Any) Image[source]

Stylize an existing PNG image using the selected method.

Parameters:
  • png_path – Path to the input PNG geometry image.

  • output_path – Output file path. If None, uses a temporary path.

  • **kwargs – Method-specific parameters (passed to the underlying method).

Returns:

Stylized image as PIL Image.

Example

>>> stylizer = Stylizer(method="brushstrokesengine")
>>> stylized_image = stylizer.run_from_png("input.png", output_path="output.png")
property style_id: str | None

Get the style ID (if supported by the method).

Module contents

Sketch Stylization Module

This module provides a unified API for stylizing sketches using various methods.

class sketchkit.stylization.Stylizer(method: str = 'brushstrokesengine', **kwargs: Any)[source]

Bases: object

A unified wrapper class for stylizing sketches using various methods.

This class provides a consistent API across different stylization methods, allowing users to switch between methods easily.

method

The stylization method being used.

Type:

str

_stylizer

The underlying method-specific stylizer instance.

property model_name: str | None

Get the model name (if supported by the method).

run(sketch: Sketch, output_path: str | None = None, **kwargs: Any) Image[source]

Stylize a sketch using the selected method.

Parameters:
  • sketch – Input vector sketch.

  • output_path – Output file path. If None, uses a temporary path.

  • **kwargs – Method-specific parameters (passed to the underlying method).

Returns:

Stylized image as PIL Image.

Example

>>> stylizer = Stylizer(method="brushstrokesengine")
>>> stylized_image = stylizer.run(sketch, output_path="output.png")
run_from_png(png_path: str | Path, output_path: str | None = None, **kwargs: Any) Image[source]

Stylize an existing PNG image using the selected method.

Parameters:
  • png_path – Path to the input PNG geometry image.

  • output_path – Output file path. If None, uses a temporary path.

  • **kwargs – Method-specific parameters (passed to the underlying method).

Returns:

Stylized image as PIL Image.

Example

>>> stylizer = Stylizer(method="brushstrokesengine")
>>> stylized_image = stylizer.run_from_png("input.png", output_path="output.png")
property style_id: str | None

Get the style ID (if supported by the method).