fromPath static method
Creates a terminal image from an image file.
size specifies the desired dimensions in terminal cells
path is the path to the image file
backgroundColor is used for transparent pixels
Implementation
static NativeTerminalImage fromPath({
required Size size,
required String path,
Color? backgroundColor,
}) {
var image = img.decodeImage(File(path).readAsBytesSync());
if (image == null) throw ArgumentError("File could not be decoded");
// Resize image to match terminal dimensions
image = img.copyResize(image, width: size.width, height: size.height);
return NativeTerminalImage.fromRealImage(
image: image,
backgroundColor: backgroundColor,
);
}