scistag.imagestag.pixel_format.PixelFormat

class PixelFormat(value)[source]

Bases: IntEnum

Enumeration of different pixel formats

Methods

from_pil

Returns a color format definition from PIL to ImageStag

to_pil

Returns the corresponding PIL color format :rtype: Literal['RGB', 'RGBA', 'L', 'HSV'] | None :return: The PIL format code if a corresponding format exists, NOne otherwise

get_band_names

Returns the names of the single bands

get_full_band_names

Returns the (fulL) names of the single bands

Attributes

RGB

Red Green Blue

RGBA

Red Green Blue Alpha

HSV

Hue Saturation Value

BGR

Blue Green Red

BGRA

Blue Green Red Alpha

GRAY

Grayscale

UNSUPPORTED

Unsupported format

bands

Returns the count of bands this pixel type uses

data_type

Returns the data type used for the storage of pixels of this type

__doc__

__members__

__module__

classmethod from_pil(pil_format)[source]

Returns a color format definition from PIL to ImageStag

Parameters

pil_format (str) – The format string such as “rgb”

Returns

The SciStag format

get_band_names()[source]

Returns the names of the single bands

Returns

The bands, e.g. [‘R’, ‘G’, ‘B’]

get_full_band_names()[source]

Returns the (fulL) names of the single bands

Returns

The bands, e.g. [‘Red’, ‘Green’, ‘Blue’]

to_pil()[source]

Returns the corresponding PIL color format :rtype: Literal[‘RGB’, ‘RGBA’, ‘L’, ‘HSV’] | None :return: The PIL format code if a corresponding format exists, NOne

otherwise

BGR = 5

Blue Green Red

BGRA = 6

Blue Green Red Alpha

GRAY = 10

Grayscale

HSV = 2

Hue Saturation Value

RGB = 0

Red Green Blue

RGBA = 1

Red Green Blue Alpha

UNSUPPORTED = 99

Unsupported format

property bands: int

Returns the count of bands this pixel type uses

Return type

int

Returns

The count of bands (channels)

property data_type: type

Returns the data type used for the storage of pixels of this type

Return type

type

Returns

The count of bands (channels)