scistag.imagestag.ascii_image.AsciiImage¶
- class AsciiImage(image, method=AsciiImageMethod.GRAY_LEVELS_10, max_width=80, **params)[source]¶
Bases:
objectHelper class for converting images from RGB to ASCII, e.g. for being able to add images to text-only logs and to provide at least a coarse “preview” of the real image.
- Parameters
image (
Image) – The input imagemax_width – The maximum characters per row
params – Advanced parameters
Methods
Converts the whole image from pixles to ASCII characters
Converts a single row from pixels to characters
Returns the converted image :rtype:
str:return:Attributes
__dict____doc____module____weakref__list of weak references to the object (if defined)
The image to be converted
The maximum character count per row
The ASCII representation of the image after it's conversion
The scaled image
Defines if the conversion was executed already
The conversion dictionary to use
- convert()[source]¶
Converts the whole image from pixles to ASCII characters
- Return type
- Returns
Self
- convert_row(pixels)[source]¶
Converts a single row from pixels to characters
- Parameters
pixels (
ndarray) – The pixel data- Return type
- Returns
The characters
- dictionary¶
The conversion dictionary to use
- image¶
The image to be converted
- is_converted¶
Defines if the conversion was executed already
- max_width¶
The maximum character count per row