image_transformer package

Subpackages

Submodules

image_transformer.constants module

This module defines constants for various image processors, pixel processors, and output builders used in the project.

image_transformer.image_transformer module

This module provides the ImageTransformer class, which is used to transform images using various processors and save the output.

class image_transformer.image_transformer.ImageTransformer(image_array: ndarray)[source]

Bases: object

A class used to transform images using various processors and save the output.

classmethod from_pil_image(pil_image: <module 'PIL.Image' from '/home/runner/work/image-transformer/image-transformer/.venv/lib/python3.12/site-packages/PIL/Image.py'>) ImageTransformer[source]

Class method to create an ImageTransformer instance from a PIL image.

Parameters:

pil_image (PIL.Image) – A PIL image object.

Returns:

An instance of ImageTransformer.

Return type:

ImageTransformer

steps: list[str] = ['step-1', 'step-2']
transform_and_save(image_processor: GenericGridImageProcessor, pixels_processor: GenericPixelsProcessor, output_builder: GenericOutputBuilder, callback: Callable[[str, int], None] | None = None) Any[source]

Transforms the image using the provided processors and saves the output.

Parameters:
  • image_processor (GenericGridImageProcessor) – An object responsible for processing the image grid.

  • pixels_processor (GenericPixelsProcessor) – An object responsible for processing the pixels.

  • output_builder (GenericOutputBuilder) – An object responsible for building the output.

  • callback (Optional[Callable[[str, int], None]]) – A callback function to report progress.

Returns

Any: The result of the output builder’s save method.

image_transformer.index module

This module provides the main entry point for the image-transformer program. It parses command-line arguments, loads an image, processes it using specified image and pixel processors, and outputs the result as an SVG file.

image_transformer.index.main()[source]

Main function to execute the image transformation process.

Module contents

This module initializes the image_transformer package by importing all functions and classes from the image_transformer module.