convertImage function
Converts the image to ASCII text.
image
the image to be converted
maxWidth
the optional maximum width of the image in characters, defaults to 80
maxHeight
the optional maximum height of th image in characters, defaults to null, so the image is called linearly
charset
the optional charset from darkest to lightest character, defaults to '#@%=+*:-. '
invert
allows to invert pixels, so that a dark pixel gets a bright character and vise versa. This is useful when printing bight text on a dark background (console). Defaults to false.
fontHeightCompensationFactor
the optional factor between 0 and 1 that is used to adjust the height of the image. Most fonts have a greater height than width, so this factor allows to compensate this. Defaults to 0.6.
Implementation
String convertImage(
Image image, {
int maxWidth = 80,
int? maxHeight,
String charset = _asciiGrayScaleCharacters,
bool invert = false,
double fontHeightCompensationFactor = 0.6,
}) {
return ImageConverter.convertImage(
image,
maxWidth: maxWidth,
maxHeight: maxHeight,
charset: charset,
invert: invert,
fontHeightCompensationFactor: fontHeightCompensationFactor,
);
}