API Documentation

Main module.

class shrinkix.Shrinkix(*, keep_metadata=None, max_width=None, max_height=None, experimental_color_reduction=None, verbose=False, artist=None, copyright=None, background=None, quality=None)[source]

Bases: object

Parameters:
  • keep_metadata (bool | None)

  • max_width (int | None)

  • max_height (int | None)

  • experimental_color_reduction (bool | None)

  • verbose (bool)

  • artist (str | None)

  • copyright (str | None)

  • background (str | None)

  • quality (int | None)

__init__(*, keep_metadata=None, max_width=None, max_height=None, experimental_color_reduction=None, verbose=False, artist=None, copyright=None, background=None, quality=None)[source]

Instantiate Shrinkix.

Parameters:
  • keep_metadata (bool | None)

  • max_width (int | None)

  • max_height (int | None)

  • experimental_color_reduction (bool | None)

  • verbose (bool)

  • artist (str | None)

  • copyright (str | None)

  • background (str | None)

  • quality (int | None)

Return type:

None

shrink(image, output, format=None, colors=None)[source]

Shrink an image.

Parameters:
  • image (str | Path | IO[bytes] | Image | SupportsArrayInterface)

  • output (str | Path | IO[bytes])

  • format (Literal['PNG', 'JPEG', 'JPG', 'WEBP'] | None)

  • colors (int | None)

Return type:

None

export_name(path, format)[source]

Export name.

Parameters:
  • path (Path)

  • format (str | None)

Return type:

str

bulk(files, output, inplace=None, format=None, colors=None)[source]

Shrink a list of file and export it in output.

Parameters:
  • files (list[str | Path])

  • output (str | Path | None)

  • inplace (bool | None)

  • format (Literal['PNG', 'JPEG', 'JPG', 'WEBP'] | None)

  • colors (int | None)

Return type:

None

reduce(image, colors=None)[source]

Reduce image colors.

Parameters:
  • image (str | Path | IO[bytes] | Image | SupportsArrayInterface)

  • colors (int | None)

Return type:

Image

shrinkix.entrypoint(argv=None)[source]

Entrypoint for command line interface.

Parameters:

argv (Sequence[str] | None)

Return type:

None