Skip to main content

imgcat

Generates an iTerm2-compatible escape sequence to display an image from a specified file path directly in the terminal.

def imgcat(
path: string,
inline: integer = 1,
preserve_aspect_ratio: integer = 0,
**kwargs: Any
) - > string

Generates an iTerm2-compatible escape sequence to display an image directly in the terminal.

Parameters

NameTypeDescription
pathstringThe local file system path to the image file to be displayed.
inlineinteger = 1Controls whether the image is displayed inline (1) or as an attachment (0).
preserve_aspect_ratiointeger = 0Determines if the image should maintain its original aspect ratio (1) or scale to fit (0).
**kwargsAnyAdditional keyword arguments for future extensibility or internal configuration.

Returns

TypeDescription
stringA formatted string containing the ANSI escape sequence and base64-encoded image data.