Skip to content
ConsoleMonster
Cmdlet

Show-ConsoleImage

Module
ConsoleMonster
Inputs
System.Management.Automation.PSObject

Shows an image in the console, at the size you ask for in cells.

Syntax

Show-ConsoleImage
[-Height <Int32>]
[-Label <String>]
[[-Path] <String>]
[-Protocol <HalfBlock|Sixel|ITerm2|Kitty>]
[-Width <Int32>]
[<CommonParameters>]
#
Parameter set: Path
Show-ConsoleImage
-Bytes <Byte[]>
[-Height <Int32>]
[-Label <String>]
[-Protocol <HalfBlock|Sixel|ITerm2|Kitty>]
[-Width <Int32>]
[<CommonParameters>]
#
Parameter set: Bytes

Description

Draws real pixels in terminals with an image protocol: Kitty and Ghostty (Kitty graphics), iTerm2 and WezTerm (iTerm2 inline images) and Windows Terminal (Sixel). Other terminals with 256 colours or more get half blocks. Redirected, CI, remote, 16-colour and no-colour output, the ISE and sessions with a transcript running get one line, [image: name WxH]. Get-ConsoleCapability shows the protocol in ImageProtocol. The aspect ratio is always kept. To put an image inside a panel or dashboard, use New-ConsoleImage.

Examples

Example 1

Show-ConsoleImage -Path ./chart.png -Width 40

Show a chart 40 cells wide

Example 2

Get-ChildItem ./screens -Filter *.png | Show-ConsoleImage -Height 12

Preview every screenshot in a folder

Example 3

Show-ConsoleImage -Path ./logo.png -Width 24 -Protocol HalfBlock

Use half blocks, for example over a connection that drops image sequences

Example 4

Show-ConsoleImage -Path ./diagram.png -Protocol Kitty

Use Kitty graphics in a terminal that supports it but isn't detected

Parameters

-Height Int32 optional
Height in cells. With -Width as well, the image fits inside that box; the aspect ratio is always kept.
-Label String optional
The text in the placeholder that redirected and CI output get, [image: label WxH]. Defaults to the file name.
-Path String optionalposition: 0sets: Path
A PNG, JPEG, GIF, BMP, TIFF or PPM file. Files from Get-ChildItem and path strings can also be piped in.
-Protocol ImageProtocol optional
The protocol your terminal supports, when detection chose another one: Kitty, ITerm2, Sixel, HalfBlock or None (the placeholder). Redirected and CI output keep the placeholder.
Possible values: HalfBlock, Sixel, ITerm2, Kitty
-Width Int32 optional
Width in cells. Without -Width or -Height the image takes one cell per 10 pixels, up to the window width.
-Bytes Byte[] requiredsets: Bytes
Encoded image bytes, for example a chart rendered to PNG in memory.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.